Skip to content

Commit

Permalink
Fix nil reference panic when a scan fails to start - do not add an it…
Browse files Browse the repository at this point in the history
…erator to Hub.runningIterators until scan is started successfully. Closes #298
  • Loading branch information
kaidaguerre committed Mar 6, 2023
1 parent e43d1fb commit 288c063
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hub/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const (

// Hub is a structure representing plugin hub
type Hub struct {
connections *connectionFactory
connections *connectionFactory

// list of iterators currently executing scans
runningIterators []Iterator

// if the cache is enabled/disabled by a metacommand, this will be non null
Expand Down Expand Up @@ -308,8 +310,6 @@ func (h *Hub) GetIterator(columns []string, quals *proto.Quals, unhandledRestric
return nil, err
}

// store the iterator
h.addIterator(iterator)
return iterator, nil
}

Expand Down Expand Up @@ -698,6 +698,10 @@ func (h *Hub) StartScan(i Iterator) error {
return err
}
iterator.Start(stream, ctx, cancel)

// add iterator to running list
h.addIterator(iterator)

return nil
}

Expand Down

0 comments on commit 288c063

Please sign in to comment.