android - java.lang.NullPointerException encountered in an unexpected place -


i'm perplexed question: there situation in first line in following 3 lines can produce java.lang.nullpointerexception?

if (mjobs == null || mjobs.size() == 0) { <-- trace shows exception here     return null; } 

this exception seen on unrooted android 4.4.4 phone. mjobs declared this:

arraylist<job> mjobs; 

any ideas highly appreciated.

update: crash happened 1 time out many thousands of runs.

no, assuming using java.util.arraylist , not own implementation.

it clearer use isempty() instead of size() == 0. check see how code getting called since returning null in either of 2 cases.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -