diff --git a/cmd/rqlite/main.go b/cmd/rqlite/main.go index a00b36dd..ba43dccf 100644 --- a/cmd/rqlite/main.go +++ b/cmd/rqlite/main.go @@ -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