mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 16:13:10 -06:00
Break loop earlier, don't decrement i twice
This commit is contained in:
parent
2ee03fd657
commit
b1add4cab5
|
|
@ -282,17 +282,17 @@ func (d *Database) addState(
|
|||
var found bool
|
||||
for i := len(state) - 1; i >= 0; i-- {
|
||||
found = false
|
||||
blocksLoop:
|
||||
for _, events := range blocks {
|
||||
for _, event := range events {
|
||||
if state[i].EventNID == event {
|
||||
found = true
|
||||
break
|
||||
break blocksLoop
|
||||
}
|
||||
}
|
||||
}
|
||||
if found {
|
||||
state = append(state[:i], state[i+1:]...)
|
||||
i--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue