Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error when reading an iso15693 nfc tag with no blocks #3229

Merged
merged 2 commits into from
Dec 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions lib/nfc/protocols/iso15693_3/iso15693_3_poller_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,30 @@ Iso15693_3Error iso15693_3_poller_activate(Iso15693_3Poller* instance, Iso15693_
break;
}

// Read blocks: Optional command
simple_array_init(data->block_data, system_info->block_count * system_info->block_size);
ret = iso15693_3_poller_read_blocks(
instance,
simple_array_get_data(data->block_data),
system_info->block_count,
system_info->block_size);
if(ret != Iso15693_3ErrorNone) {
ret = iso15693_3_poller_filter_error(ret);
break;
}

// Get block security status: Optional command
simple_array_init(data->block_security, system_info->block_count);

ret = iso15693_3_poller_get_blocks_security(
instance, simple_array_get_data(data->block_security), system_info->block_count);
if(ret != Iso15693_3ErrorNone) {
ret = iso15693_3_poller_filter_error(ret);
break;
if(system_info->block_count > 0) {
// Read blocks: Optional command
simple_array_init(
data->block_data, system_info->block_count * system_info->block_size);
ret = iso15693_3_poller_read_blocks(
instance,
simple_array_get_data(data->block_data),
system_info->block_count,
system_info->block_size);
if(ret != Iso15693_3ErrorNone) {
ret = iso15693_3_poller_filter_error(ret);
break;
}

// Get block security status: Optional command
simple_array_init(data->block_security, system_info->block_count);

ret = iso15693_3_poller_get_blocks_security(
instance, simple_array_get_data(data->block_security), system_info->block_count);
if(ret != Iso15693_3ErrorNone) {
ret = iso15693_3_poller_filter_error(ret);
break;
}
}

} while(false);

return ret;
Expand Down