3 ms·
Easy, just add "if (thing == null) return;" to the top of the function that crapped out on a null reference and close the ticket! /s
by cylon13 7y ago
Easy, just add "if (thing == null) return;" to the top of the function that crapped out on a null reference and close the ticket! /s
- int_19h 7y agoSarcasm aside, this is often how it gets fixed in poor quality codebases! And if it returns a reference itself, it ends up being: if (thing == null) return null; more often than not. Which leads to an even more entertaining debuggin trip next time...
- cylon13 7y agoOh for sure. I wish I would have thought of that sarcastic quip by being creative, but in reality it's because I've seen it so many times.