buttplugio / buttplug-rs-ffi

FFI from buttplug-rs to Java and other languages
Other
89 stars 22 forks source link

[C#] Add null checking for events on invoke #46

Closed tjhorner closed 3 years ago

tjhorner commented 3 years ago

If the events that are invoked don't actually have any handlers, the entire application will crash with a NullReferenceException. This adds a null check before firing any events so that it doesn't happen.

This issue made me very sad because I had no idea what was going on because Visual Studio wouldn't actually tell me, so I had to download the project and add it as a reference instead of getting it from NuGet. I kept thinking it was an issue with my code somehow, but it wasn't. :(

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

qdot commented 3 years ago

Wow, can't believe I missed that, thanks for the patch. The hazards of hopping languages constantly. :c

Yeah, library is... 2 weeks old in official release and there are currently zero tests at the FFI level, so expect pain like this for a bit while things stabilize.

qdot commented 3 years ago

Just did a quick release of v1.0.7 w/ your patch on nuget. Should be live in the next 5-10 min.

https://www.nuget.org/packages/Buttplug/1.0.7

tjhorner commented 3 years ago

Awesome, thanks! Really appreciate the quick merge and release.

qdot commented 3 years ago

Yeah, feel free to smack me on twitter/telegram/discord if you run into anything else (though PRs welcome too). This is some real unfortunate testing in production happening right now, like the past 4 releases before this were the FFXIV Aethersense people going "It broke again :( ".