aboutsummaryrefslogtreecommitdiffstats
path: root/core/chain_manager.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/chain_manager.go')
-rw-r--r--core/chain_manager.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/chain_manager.go b/core/chain_manager.go
index dcd8df28f..3f2b3a26a 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -322,7 +322,12 @@ func (self *ChainManager) Export(w io.Writer) error {
last := self.currentBlock.NumberU64()
for nr := uint64(0); nr <= last; nr++ {
- if err := self.GetBlockByNumber(nr).EncodeRLP(w); err != nil {
+ block := self.GetBlockByNumber(nr)
+ if block == nil {
+ return fmt.Errorf("export failed on #%d: not found", nr)
+ }
+
+ if err := block.EncodeRLP(w); err != nil {
return err
}
}