Browse files

Handle null pointer in PopLocalFrame

  • Loading branch information...
1 parent 887a32b commit cad4719f7dcf2d239b3b39afd3cc7943503dbd4d @csoren csoren committed with dicej Dec 21, 2012
Showing with 14 additions and 5 deletions.
  1. +14 −5 src/jnienv.cpp
View
19 src/jnienv.cpp
@@ -3370,12 +3370,21 @@ PushLocalFrame(Thread* t, jint capacity)
uint64_t
popLocalFrame(Thread* t, uintptr_t* arguments)
{
- object result = *reinterpret_cast<jobject>(arguments[0]);
- PROTECT(t, result);
+ uint64_t r;
+ jobject presult = reinterpret_cast<jobject>(arguments[0]);
+ if(presult != NULL) {
+ object result = *presult;
+ PROTECT(t, result);
- t->m->processor->popLocalFrame(t);
-
- return reinterpret_cast<uint64_t>(makeLocalReference(t, result));
+ t->m->processor->popLocalFrame(t);
+
+ r = reinterpret_cast<uint64_t>(makeLocalReference(t, result));
+ } else {
+ t->m->processor->popLocalFrame(t);
+ r = 0;
+ }
+
+ return r;
}
jobject JNICALL

0 comments on commit cad4719

Please sign in to comment.