cumulusmx / CumulusMX

The CumulusMX weather program
GNU General Public License v3.0
82 stars 23 forks source link

Fix Object reference not set to an instance of an object fault #96

Closed gdevic closed 3 years ago

gdevic commented 3 years ago

This fixes "Object reference not set to an instance of an object." fault with a clean installation on startup.

mcrossley commented 3 years ago

Thanks for this. I wonder though, rather than check every real time interval for station==null, to check in the internet settings and not enable the timer if the station is null? This would prevent the error occurring on initial configuration.

The internet settings module does not currently have a reference to the station so that would have to be added as well.

gdevic commented 3 years ago

That could probably be a separate change since it might be more involved. This change, it just seems like a good idea to check for null before using it, just like it was done in a few preceding lines, so it wraps that up in a way. It fixes the unfortunate crash which many new users will likely hit on their first run (creating a bad user experience).