Fix infinite loop on empty DirectoryContents
When changing to an empty directory, ml.selected is 0, and the length of ml.store.Uids is 0. The loop condition is always true so we have an infinite loop causing 100% CPU usage and prevents us to change to other directories. Signed-off-by: Tom Lebreux <tomlebreux@cock.li>
This commit is contained in:
parent
8a42dfc87c
commit
41212a717e
1 changed files with 4 additions and 2 deletions
|
@ -111,9 +111,11 @@ func (ml *MessageList) storeUpdate(store *lib.MessageStore) {
|
||||||
if ml.store != store {
|
if ml.store != store {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(ml.store.Uids) > 0 {
|
||||||
for ml.selected >= len(ml.store.Uids) {
|
for ml.selected >= len(ml.store.Uids) {
|
||||||
ml.Prev()
|
ml.Prev()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ml.Invalidate()
|
ml.Invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue