Skip to content

Commit

Permalink
Add isEmpty check
Browse files Browse the repository at this point in the history
  • Loading branch information
chimp1984 committed Nov 9, 2021
1 parent c600259 commit 1108e98
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ protected void readFromResources(String postFix, Runnable completeHandler) {
if (daoStateAsProto.getBlocksList().isEmpty()) {
int chainHeight = daoStateAsProto.getChainHeight();
list = bsqBlocksStorageService.readBlocks(chainHeight);
int heightOfLastBlock = list.getLast().getHeight();
checkArgument(heightOfLastBlock == chainHeight,
"heightOfLastBlock must match chainHeight");
if (!list.isEmpty()) {
int heightOfLastBlock = list.getLast().getHeight();
checkArgument(heightOfLastBlock == chainHeight,
"heightOfLastBlock must match chainHeight");
}
} else {
list = bsqBlocksStorageService.migrateBlocks(daoStateAsProto.getBlocksList());
}
Expand Down

0 comments on commit 1108e98

Please sign in to comment.