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 if customEvents is null before accessing #28

Open
RobbyZ opened this issue Apr 1, 2022 · 0 comments
Open

Check if customEvents is null before accessing #28

RobbyZ opened this issue Apr 1, 2022 · 0 comments

Comments

@RobbyZ
Copy link

RobbyZ commented Apr 1, 2022

Thanks for this great resource :)

I found a small bug. I am checking events first before adding them to ensure I don't double-add a custom event. But if I do this, I'll get a null reference exception because customEvents is null until one is defined.

if (customEvents.ContainsKey(eventInfo))

I added a null check to this if:

if (customEvents != null && customEvents.ContainsKey(eventInfo))

But maybe would be better to just always define customEvents on init? If not, there may be some other places where customEvents is accessed without null check.

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

No branches or pull requests

1 participant