From 18b3500f2c2253cf6fc902d54ce8243ad32f3f2e Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 11 May 2018 13:10:15 -0500 Subject: [PATCH] Add null check with exception expected by net_plugin --- libraries/chain/controller.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 9bde7f675e7..bf28189b466 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1189,7 +1189,12 @@ block_id_type controller::get_block_id_for_num( uint32_t block_num )const { try return blk_state->id; } - return my->blog.read_block_by_num(block_num)->id(); + auto signed_blk = my->blog.read_block_by_num(block_num); + + EOS_ASSERT( BOOST_LIKELY( signed_blk != nullptr ), unknown_block_exception, + "Could not find block: ${block}", ("block", block_num) ); + + return signed_blk->id(); } FC_CAPTURE_AND_RETHROW( (block_num) ) } void controller::pop_block() {