mirror of
https://github.com/EnumeratedDev/typer.git
synced 2026-09-16 05:36:10 +00:00
Fix panic when saving empty file
This commit is contained in:
+1
-1
@@ -134,7 +134,7 @@ func (buffer *Buffer) Save() error {
|
||||
}
|
||||
|
||||
// Append new line character at end of buffer contents if not present
|
||||
if buffer.Contents[len(buffer.Contents)-1] != '\n' {
|
||||
if buffer.Contents == "" || buffer.Contents[len(buffer.Contents)-1] != '\n' {
|
||||
buffer.Contents += "\n"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user