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

Check that generator is successfully created before using #103

Merged
merged 1 commit into from Nov 27, 2020

Conversation

chrisroberts
Copy link
Contributor

This is just a simple little fix. I ran into this when I had misspelled PackageName in the yaml file. When the key was missing, the generator was not created and resulted in a panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x5ff014]

goroutine 1 [running]:
github.com/xlab/c-for-go/generator.(*Generator).SetMaxMemory(0x0, 0x7439f5, 0xa)
        /home/spox/Projects/xlab/c-for-go/generator/generator.go:509 +0xb4
main.NewProcess(0x7ffdb591a37e, 0x9, 0x7ffdb591a375, 0x8, 0xc0000b6930, 0xc000099140, 0x42aad800)
        /home/spox/Projects/xlab/c-for-go/process.go:99 +0x409
main.main()
        /home/spox/Projects/xlab/c-for-go/main.go:79 +0x1c5

This just moves the error check prior to the usage of the generator which results in the expected behavior:

[ERR] no package name provided

@xlab
Copy link
Owner

xlab commented Nov 27, 2020

Oof, thanks! That was some weird merge side-effect, so that line got above the error check. Sorry :)

@xlab xlab merged commit 3db16f6 into xlab:master Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants