Fix bug with opening empty files

This commit is contained in:
Zachary Yedidia
2016-11-29 16:25:16 -05:00
parent 370e667e91
commit 6fbff048f0

View File

@@ -104,7 +104,11 @@ func LoadInput() []*Buffer {
}
}
// If the file didn't exist, input will be empty, and we'll open an empty buffer
buffers = append(buffers, NewBuffer(input, filename))
if input != nil {
buffers = append(buffers, NewBuffer(input, filename))
} else {
buffers = append(buffers, NewBuffer(strings.NewReader(""), filename))
}
}
} else if !isatty.IsTerminal(os.Stdin.Fd()) {
// Option 2