GreepTheSheep / openplanet-MXRandom

An Openplanet plugin that takes a random map from MX / TMX and play it
https://openplanet.dev/plugin/mxrandom
GNU General Public License v3.0
19 stars 28 forks source link

Fix null pointer exception with player best times #90

Closed XertroV closed 1 year ago

XertroV commented 1 year ago

Additionally add a try {} catch {} so recovery is possible if an exception is thrown.

Should fix #89

Note: made PR from github so please confirm this compiles.

The only substantial change (besides try catch) is this line: if (player.BestRaceTimes is null || player.BestRaceTimes.Length != raceData.CPsToFinish) continue;

XertroV commented 1 year ago

If possible, I'd suggest a one-time-notification thing would be useful for when an error like this is detected. Warning in the logs is okay except that it's not obvious if it happens. But if there's a warning notif then at least there's some way to notice and gather some data about when it might be happening (and it's a prompt to check the logs at that point, too -- does it keep happening or is it just something that happens on one frame? etc)

XertroV commented 1 year ago

Confirmed that it compiles