summaryrefslogtreecommitdiff
path: root/libjava/jni.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-27 15:33:24 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-27 15:33:24 +0000
commit426f02615d7e0380b7153e58270cb791ccd380f4 (patch)
tree13cfcf691ed1709219a0b4189d313ba52839509e /libjava/jni.cc
parent02ab82c4c8e838aa6d44c5977cf028e2791e6421 (diff)
downloadgcc-426f02615d7e0380b7153e58270cb791ccd380f4.tar.gz
PR libgcj/28178:
* jni.cc (_Jv_JNI_DeleteLocalRef): Ignore null argument. (_Jv_JNI_DeleteGlobalRef): Likewise. * testsuite/libjava.jni/PR28178.java: New file. * testsuite/libjava.jni/PR28178.c: New file. * testsuite/libjava.jni/PR28178.out: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115034 138bc75d-0d04-0410-961f-82ee72b054a4
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 19539c7714a..67ba8fa4941 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)