-
Notifications
You must be signed in to change notification settings - Fork 33
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
Panic when invalid config is passed #9
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @mcuadros. A while back I blindly submitted a PR which I prepared in my head. My idea was to catch panics which were caused by an invalid config or not running as root. But I just noticed that this doesn't work as expected.
The reason why the code panics is located in these two lines.
If the application is not running as root,
m
will benil
. Why this case is handled,m
is still passed tob := C.led_matrix_create_offscreen_canvas(m)
without checking thatm
is notnil
! This causes the panic.A simple solution could look like this:
Feel free to suggest a different solution or drop me line if you want me to prepare a PR.
The text was updated successfully, but these errors were encountered: