Adds nil check to opSearch source in ExitSearchMode to prevent panic when exiting search mode with no history

This commit is contained in:
ZadenRB 2018-07-29 23:29:26 -06:00
parent 2972be24d4
commit d6ddc94f3b
1 changed files with 6 additions and 2 deletions

View File

@ -114,8 +114,12 @@ func (o *opSearch) SearchMode(dir int) bool {
func (o *opSearch) ExitSearchMode(revert bool) {
if revert {
o.history.current = o.source
o.buf.Set(o.history.showItem(o.history.current.Value))
if o.source != nil {
o.history.current = o.source
o.buf.Set(o.history.showItem(o.history.current.Value))
} else {
o.buf.Set(make([]rune, 0))
}
}
o.markStart, o.markEnd = 0, 0
o.state = S_STATE_FOUND