Skip to content

Commit

Permalink
Use the return of retry_read_block_by_num only if it is not nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
linh2931 committed Sep 16, 2024
1 parent 907dcdc commit 5211dea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/chain/block_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,12 @@ namespace eosio { namespace chain {
if (pos == block_log::npos || !head) {
// Rare case. No need a special code for it.
// Just fall back to the regular `retry_read_block_by_num` and then serialize.
return fc::raw::pack(*(retry_read_block_by_num(block_num)));
auto ret = retry_read_block_by_num(block_num);
if (ret) {
return fc::raw::pack(*ret);
} else {
return {};
}
}

if (verify_block_num == verify_block_num_t::yes) {
Expand Down

0 comments on commit 5211dea

Please sign in to comment.