aboutsummaryrefslogtreecommitdiff
path: root/libjava/jni.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r--libjava/jni.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc
index 19539c7..67ba8fa 100644
--- a/libjava/jni.cc
+++ b/libjava/jni.cc
@@ -248,6 +248,12 @@ _Jv_JNI_DeleteGlobalRef (JNIEnv *, jobject obj)
{
// This seems weird but I think it is correct.
obj = unwrap (obj);
+
+ // NULL is ok here -- the JNI specification doesn't say so, but this
+ // is a no-op.
+ if (! obj)
+ return;
+
unmark_for_gc (obj, global_ref_table);
}
@@ -259,6 +265,11 @@ _Jv_JNI_DeleteLocalRef (JNIEnv *env, jobject obj)
// This seems weird but I think it is correct.
obj = unwrap (obj);
+ // NULL is ok here -- the JNI specification doesn't say so, but this
+ // is a no-op.
+ if (! obj)
+ return;
+
for (frame = env->locals; frame != NULL; frame = frame->next)
{
for (int i = 0; i < frame->size; ++i)