einsteinx2/WaveBox

Add null checks when casting from nullable to value type

Opened this issue · 2 comments

We do stuff like (int)Folder.folderId all over the place, but these ids and other value properties can be null sometimes. We need to be checking for this and handling appropriately, rather than crashing.

Out of curiosity, have you ever noticed this actually crashing? I agree we should definitely check our code, but we have already have a lot of checks in place to prevent certain fields from ever being put in the database as null.

I've fixed one or two crashes related to this. But what's more likely is some unexpected data set or circumstance causing crashes that would have been prevented with adequate checking. If our goal is to have something super stable even in the face of unexpected input, then we need to do this.