Ensure we don't AddLocalReference a bogus value when returning to native code from an upcall that threw.

Also add a few missing CHECKs.

Change-Id: Icf29506b258a2177b5e80c75cd2710761431ba4b
diff --git a/src/class_linker.cc b/src/class_linker.cc
index b9dbf89..344f844 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1194,6 +1194,7 @@
       return NULL;
     }
     ScopedLocalRef<jobject> class_loader_object(env, AddLocalReference<jobject>(env, class_loader));
+    CHECK(class_loader_object.get() != NULL);
     ScopedLocalRef<jobject> result(env, env->CallObjectMethod(class_loader_object.get(), mid,
                                                               class_name_object.get()));
     if (env->ExceptionCheck()) {