Today I saw another developer experience a
NullPointerException inside
sendBroadcastSync on a
LocalBroadcastManager. The manager wasn't null, but it turned out some other part of the application had called
registerReceiver passing a null reference. So when Android tried to deliver the intent, it tried to call a method on that null it had stored. I'm not sure of a good way to investigate this in a large codebase, but in Robolectric tests a shadow could be written that fails immediately if passed a null broadcast receiver.
No comments:
Post a Comment