Fix nfc_protocol_support_scene_save_name_on_event crash#3418
Fix nfc_protocol_support_scene_save_name_on_event crash#3418hedger merged 3 commits intoflipperdevices:devfrom
Conversation
gornekich
left a comment
There was a problem hiding this comment.
Hi @xMasterX , thanks for PR!
The problem behind this issue is in nfc_protocol_support_scene_save_name_on_event() function. We assume that we come to this scene after reading and get protocol from list of detected protocols, however we may come to this scene from "Add manually". If MfClassic protocol was detected before, it leads to call of nfc_scene_save_name_on_event_mf_classic() function and flipper crashes on nfc_get_data() call with incorrect protocol.
Your fix works because there is no "save_name_*()" functions for Iso14443a protocols. However it may lead to another issues if we implement these function in future.
The correct fix is to get protocol from nfc_device in nfc_protocol_support_scene_save_name_on_event() function. Please, consider the patch with these fixes and if everything is OK, apply it and we will merge your PR.
fix_save_name.txt
Hi, For some reason part of the functions in And yes if About your patch and Not clearing the array at |
I just didn't like setting array of detected protocol to NfcProtocolIso14443_3a explicitly from start scene. What if we change value of NfcProtocolIso14443_3a to another value by just changing order in enumeration. The correct way to deal with detected protocols is to make a private class with getters and setters. And this class will correctly reset it state internally. Thanks for noticing that. I think we should merge this PR for now, since it fixes the issue, and we will refactor working with detected protocol in future. |
What's new
protocols_detectedlist being used inAdd manuallyScene (in save_name -> on event call) after reading mifare classic tag and going to add manually with selecting other protocolVerification
Checklist (For Reviewer)