iButton: fix crash when deleting some keys

This commit is contained in:
Astra 2024-04-26 19:07:51 +09:00
parent 43c4381820
commit 42c69b076a
5 changed files with 26 additions and 2 deletions

View File

@ -200,6 +200,16 @@ static bool ibutton_protocol_group_misc_load(
}
}
static void ibutton_protocol_group_misc_render_uid(
iButtonProtocolGroupMisc* group,
const iButtonProtocolData* data,
iButtonProtocolLocalId id,
FuriString* result) {
const size_t data_size = protocol_dict_get_data_size(group->dict, id);
protocol_dict_set_data(group->dict, id, data, data_size);
protocol_dict_render_uid(group->dict, result, id);
}
static void ibutton_protocol_group_misc_render_data(
iButtonProtocolGroupMisc* group,
const iButtonProtocolData* data,
@ -283,6 +293,7 @@ const iButtonProtocolGroupBase ibutton_protocol_group_misc = {
.save = (iButtonProtocolGroupSaveFunc)ibutton_protocol_group_misc_save,
.load = (iButtonProtocolGroupLoadFunc)ibutton_protocol_group_misc_load,
.render_uid = (iButtonProtocolGroupRenderFunc)ibutton_protocol_group_misc_render_uid,
.render_data = (iButtonProtocolGroupRenderFunc)ibutton_protocol_group_misc_render_data,
.render_brief_data =
(iButtonProtocolGroupRenderFunc)ibutton_protocol_group_misc_render_brief_data,

View File

@ -198,6 +198,15 @@ LevelDuration protocol_dict_encoder_yield(ProtocolDict* dict, size_t protocol_in
}
}
void protocol_dict_render_uid(ProtocolDict* dict, FuriString* result, size_t protocol_index) {
furi_check(protocol_index < dict->count);
ProtocolRenderData fn = dict->base[protocol_index]->render_uid;
if(fn) {
return fn(dict->data[protocol_index], result);
}
}
void protocol_dict_render_data(ProtocolDict* dict, FuriString* result, size_t protocol_index) {
furi_check(protocol_index < dict->count);
ProtocolRenderData fn = dict->base[protocol_index]->render_data;

View File

@ -58,6 +58,8 @@ bool protocol_dict_encoder_start(ProtocolDict* dict, size_t protocol_index);
LevelDuration protocol_dict_encoder_yield(ProtocolDict* dict, size_t protocol_index);
void protocol_dict_render_uid(ProtocolDict* dict, FuriString* result, size_t protocol_index);
void protocol_dict_render_data(ProtocolDict* dict, FuriString* result, size_t protocol_index);
void protocol_dict_render_brief_data(ProtocolDict* dict, FuriString* result, size_t protocol_index);

View File

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,61.1,,
Version,+,61.2,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@ -2251,6 +2251,7 @@ Function,+,protocol_dict_get_validate_count,uint32_t,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_write_data,_Bool,"ProtocolDict*, size_t, void*"
Function,+,protocol_dict_render_brief_data,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_render_data,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_render_uid,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_set_data,void,"ProtocolDict*, size_t, const uint8_t*, size_t"
Function,-,pulse_reader_alloc,PulseReader*,"const GpioPin*, uint32_t"
Function,-,pulse_reader_free,void,PulseReader*

1 entry status name type params
2 Version + 61.1 61.2
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
2251 Function + protocol_dict_get_write_data _Bool ProtocolDict*, size_t, void*
2252 Function + protocol_dict_render_brief_data void ProtocolDict*, FuriString*, size_t
2253 Function + protocol_dict_render_data void ProtocolDict*, FuriString*, size_t
2254 Function + protocol_dict_render_uid void ProtocolDict*, FuriString*, size_t
2255 Function + protocol_dict_set_data void ProtocolDict*, size_t, const uint8_t*, size_t
2256 Function - pulse_reader_alloc PulseReader* const GpioPin*, uint32_t
2257 Function - pulse_reader_free void PulseReader*

View File

@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,61.1,,
Version,+,61.2,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
@ -2849,6 +2849,7 @@ Function,+,protocol_dict_get_validate_count,uint32_t,"ProtocolDict*, size_t"
Function,+,protocol_dict_get_write_data,_Bool,"ProtocolDict*, size_t, void*"
Function,+,protocol_dict_render_brief_data,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_render_data,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_render_uid,void,"ProtocolDict*, FuriString*, size_t"
Function,+,protocol_dict_set_data,void,"ProtocolDict*, size_t, const uint8_t*, size_t"
Function,-,pulse_reader_alloc,PulseReader*,"const GpioPin*, uint32_t"
Function,-,pulse_reader_free,void,PulseReader*

1 entry status name type params
2 Version + 61.1 61.2
3 Header + applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h
4 Header + applications/services/bt/bt_service/bt.h
5 Header + applications/services/cli/cli.h
2849 Function + protocol_dict_get_write_data _Bool ProtocolDict*, size_t, void*
2850 Function + protocol_dict_render_brief_data void ProtocolDict*, FuriString*, size_t
2851 Function + protocol_dict_render_data void ProtocolDict*, FuriString*, size_t
2852 Function + protocol_dict_render_uid void ProtocolDict*, FuriString*, size_t
2853 Function + protocol_dict_set_data void ProtocolDict*, size_t, const uint8_t*, size_t
2854 Function - pulse_reader_alloc PulseReader* const GpioPin*, uint32_t
2855 Function - pulse_reader_free void PulseReader*