When cleaning some of my Android apps, I found a null pointer exception in the developer console that never happened, and I assume this is a rare race condition.
For those who do not know this: Android allows the user to report failures (iE uncaught exception) back to the developer.
I already began to print the infamous if (… != null)when it occurred to me: There are only three reports. . This is very rare.
So, I ask myself: in this situation and performance wise: Wouldn't it be better to exclude a null pointer instead of an exception?
Given that if will be evaluated every time.
source
share