2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-02 11:43:23 +00:00

fix: prevent writing empty line to history

This commit is contained in:
TorchedSammy 2022-03-04 22:04:44 -04:00
parent f26ef935dd
commit 92f279e5cf
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -38,6 +38,10 @@ func newFileHistory() (*fileHistory, error) {
}
func (h *fileHistory) Write(line string) (int, error) {
if line == "" {
return len(h.items), nil
}
_, err := h.f.WriteString(line + "\n")
if err != nil {
return 0, err