Skip to content

Commit

Permalink
fix ants removal npe
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumemichel committed Dec 17, 2024
1 parent 8f80bb1 commit f335cd8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion queen.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ func (q *Queen) routine(ctx context.Context) {
logger.Debugf("need %d extra ants", len(missingKeys))
logger.Debugf("removing %d ants", len(excessAntsIndices))

// remove ants
// remove ants - sort indices in descending order to remove from end first
sort.Sort(sort.Reverse(sort.IntSlice(excessAntsIndices)))
returnedKeys := make([]crypto.PrivKey, len(excessAntsIndices))
for i, index := range excessAntsIndices {
ant := q.ants[index]
Expand Down

0 comments on commit f335cd8

Please sign in to comment.