Ignore scroll command when msgstore is nil
Fixes ~sircmpwn/aerc2#205. Many functions do a nil check on the store, so this changes Store() so it returns nil when msglist is nil. It also places the Scroll() behind the nil check in the next-message command. https://todo.sr.ht/~sircmpwn/aerc2/205
This commit is contained in:
parent
5b523880b4
commit
4478c6a4b7
|
@ -65,14 +65,14 @@ func ExecuteNextPrevMessage(args []string, acct *widgets.AccountView, pct bool,
|
||||||
store := acct.Store()
|
store := acct.Store()
|
||||||
if store != nil {
|
if store != nil {
|
||||||
store.NextPrev(-n)
|
store.NextPrev(-n)
|
||||||
|
acct.Messages().Scroll()
|
||||||
}
|
}
|
||||||
acct.Messages().Scroll()
|
|
||||||
} else {
|
} else {
|
||||||
store := acct.Store()
|
store := acct.Store()
|
||||||
if store != nil {
|
if store != nil {
|
||||||
store.NextPrev(n)
|
store.NextPrev(n)
|
||||||
|
acct.Messages().Scroll()
|
||||||
}
|
}
|
||||||
acct.Messages().Scroll()
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,9 @@ func (acct *AccountView) Messages() *MessageList {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (acct *AccountView) Store() *lib.MessageStore {
|
func (acct *AccountView) Store() *lib.MessageStore {
|
||||||
|
if acct.msglist == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return acct.msglist.Store()
|
return acct.msglist.Store()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue