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

[Bug]: TCR crashes when language provided as parameter does not exist #30

Closed
1 task done
mengdaming opened this issue Jan 12, 2022 · 0 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@mengdaming
Copy link
Contributor

Contact Details

damien.menanteau@gmail.com

Describe the bug

When running TCR with a language parameter value that does not match any of the built-in languages not any of the custom languages defined through configuration files, TCR crashes with the following trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0xa0 pc=0x7aaa41]

goroutine 1 [running]:
github.com/murex/tcr/tcr-engine/language.(*Language).setBaseDir(...)
.../tcr/tcr-engine/language/language.go:316

To Reproduce

Steps to reproduce the behavior:

  1. Open a terminal and run tcr -l xxx
  2. The trace shows a runtime error, as described in previous section

Expected behavior

I expected TCR to exit with a message saying that language "xxx" is not supported

Working Environment

  1. OS: Any
  2. Version: TCR v0.10.0

Additional Context

Cause of the error:

call to language.(*Language).setBaseDir(...) on a nil language instance pointer

Fix:

call setBaseDir(...) only when language instance pointer is not nil

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mengdaming mengdaming added the bug Something isn't working label Jan 12, 2022
@mengdaming mengdaming self-assigned this Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant