Q:

DatabaseHandler.close() - Null pointer exception even if checked

My code looks like this:
    if (dbHandler != null) dbHandler.close(); 

How is it possible getting a nullPointerException on this line? It looks like I am getting a NPE inside a system functions of SQLite.
Of course there are more similar functions but the basic structure is demonstrated i think. The weird thing is that this happened to one user (at least we dont know about others). The device should be Samsung SII with Android 4.0.4
EDIT
Solved by rewriting the databaseHandler, propably there was some more instances hazard.

A:

I was wondering about the exact same thing (see included code above). It just does not make sense that this is happening.

