diff --git a/src/main/java/org/tron/core/db/BlockIndexStore.java b/src/main/java/org/tron/core/db/BlockIndexStore.java index 123fccd3336..2cfd3d7ae28 100644 --- a/src/main/java/org/tron/core/db/BlockIndexStore.java +++ b/src/main/java/org/tron/core/db/BlockIndexStore.java @@ -1,8 +1,8 @@ package org.tron.core.db; +import java.util.Arrays; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; @@ -11,8 +11,6 @@ import org.tron.core.capsule.BytesCapsule; import org.tron.core.exception.ItemNotFoundException; -import java.util.Arrays; - @Component public class BlockIndexStore extends TronStoreWithRevoking { @@ -30,7 +28,7 @@ public void put(BlockId id) { public BlockId get(Long num) throws ItemNotFoundException { BytesCapsule value = getUnchecked(ByteArray.fromLong(num)); - if(value == null) { + if (value == null || value.getData() == null) { throw new ItemNotFoundException("number: " + num + " is not found!"); } return new BlockId(Sha256Hash.wrap(value.getData()), num);