mirror of https://github.com/chzyer/readline.git
Adds nil check to opSearch source in ExitSearchMode to prevent panic when exiting search mode with no history
This commit is contained in:
parent
2972be24d4
commit
d6ddc94f3b
|
@ -114,8 +114,12 @@ func (o *opSearch) SearchMode(dir int) bool {
|
|||
|
||||
func (o *opSearch) ExitSearchMode(revert bool) {
|
||||
if revert {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue