Skip to content

Commit 63c84cc

Browse files
committed
Avoid panic
1 parent 55d9f6f commit 63c84cc

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

indexer/indexer.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,18 @@ func (i *Indexer) addPendingHeights(p *[]uint64) error {
125125
}
126126

127127
func (i *Indexer) onDBSyncComplete(r db_buffer.SyncResult) {
128+
if r.SyncedHeights == nil {
129+
zap.S().Errorf("onDBSyncComplete received nil SyncedHeights. Check db_sync code!")
130+
return
131+
}
132+
128133
if r.Error != nil {
129134
zap.S().Errorf(r.Error.Error())
130135
// Remove WIP heights
131136
_ = tracker.UpdateInProgressHeight(false, r.SyncedHeights, i.Id, i.DbConn)
132137
return
133138
}
134139

135-
if r.SyncedHeights == nil {
136-
return
137-
}
138-
139140
err := tracker.UpdateAndRemoveWipHeights(r.SyncedHeights, i.Id, i.DbConn)
140141
if err != nil {
141142
return

0 commit comments

Comments
 (0)