mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-25 10:20:31 +00:00
Don't open buffer if there was an error loading the file
This commit is contained in:
parent
a60d348274
commit
4e4b4bfe68
1 changed files with 5 additions and 2 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue