diff --git a/libraries/chain/block_log.cpp b/libraries/chain/block_log.cpp
index 827cab3d298..5a490bd9432 100644
--- a/libraries/chain/block_log.cpp
+++ b/libraries/chain/block_log.cpp
@@ -152,7 +152,11 @@ namespace eosio { namespace chain {
          }
 
          my->head = read_head();
-         my->head_id = my->head->id();
+         if( my->head ) {
+            my->head_id = my->head->id();
+         } else {
+            my->head_id = {};
+         }
 
          if (index_size) {
             my->check_block_read();
@@ -341,6 +345,12 @@ namespace eosio { namespace chain {
 
       my->block_stream.seekg(-sizeof( uint64_t), std::ios::end);
       my->block_stream.read((char*)&end_pos, sizeof(end_pos));
+
+      if( end_pos == npos ) {
+         ilog( "Block log contains no blocks. No need to construct index." );
+         return;
+      }
+
       signed_block tmp;
 
       uint64_t pos = 0;