Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty files causes a panic #561

Closed
hachi8833 opened this issue Jan 2, 2018 · 0 comments · Fixed by #567
Closed

Empty files causes a panic #561

hachi8833 opened this issue Jan 2, 2018 · 0 comments · Fixed by #567
Labels

Comments

@hachi8833
Copy link
Member

hachi8833 commented Jan 2, 2018

If Goby runs an empty file (or only LFs contained), the following panic causes:

$ goby 50sandbox.gb # empty file
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/goby-lang/goby/compiler/bytecode.(*Generator).compileStatements(0xc420061d80, 0x48767c8, 0x0, 0x0, 0xc420089200, 0xc4200f4860)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/compiler/bytecode/statement_generation.go:25 +0x27b
github.com/goby-lang/goby/compiler/bytecode.(*Generator).GenerateInstructions(0xc420061d80, 0x48767c8, 0x0, 0x0, 0xc4200891d0, 0xc42000e030, 0xc420061db0)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/compiler/bytecode/generator.go:54 +0x5b
github.com/goby-lang/goby/compiler.CompileToInstructions(0x0, 0x0, 0x0, 0x200, 0x0, 0x0, 0x7ffeefbfe467, 0x2)
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/compiler/compiler.go:34 +0x1e0
main.main()
	/Users/hachi8833/deve/golang/gopath/sys/src/github.com/goby-lang/goby/goby.go:60 +0x303

Looks like the issue is related to #560.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant