1
0
Fork 0

History writer may be nil

If UserHomeDir() doesn't have a value, this can happen. Fixes
https://github.com/rqlite/rqlite/issues/1486. May also be caused by
failure to open the history file. In any event, this is not something
that should block the CLI from working.
master
Philip O'Toole 9 months ago
parent aad2042be1
commit 73d757313e

@ -231,11 +231,13 @@ func main() {
}
hw := history.Writer()
sz := history.Size()
history.Write(term.History, sz, hw)
hw.Close()
if sz <= 0 {
history.Delete()
if hw != nil {
sz := history.Size()
history.Write(term.History, sz, hw)
hw.Close()
if sz <= 0 {
history.Delete()
}
}
ctx.String("bye~\n")
return nil

Loading…
Cancel
Save