Sometimes, the JVM returns a non-nullptr value with an exception pending (seen on Android 1.6, maybe a Dalvik bug?). Let's catch all such cases.