Don't open buffer if there was an error loading the file

This commit is contained in:
Zachary Yedidia
2016-11-28 10:51:09 -05:00
parent a60d348274
commit 4e4b4bfe68

View File

@@ -98,8 +98,7 @@ func LoadInput() []*Buffer {
input, err = ioutil.ReadFile(filename)
if err != nil {
TermMessage(err)
input = []byte{}
filename = ""
continue
}
}
// If the file didn't exist, input will be empty, and we'll open an empty buffer
@@ -294,6 +293,10 @@ func main() {
// Now we load the input
buffers := LoadInput()
if len(buffers) == 0 {
screen.Fini()
os.Exit(1)
}
for _, buf := range buffers {
// For each buffer we create a new tab and place the view in that tab
tab := NewTabFromView(NewView(buf))