From cad4719f7dcf2d239b3b39afd3cc7943503dbd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Elton=20S=C3=B8rensen?= Date: Fri, 21 Dec 2012 09:56:21 +0100 Subject: [PATCH] Handle null pointer in PopLocalFrame --- src/jnienv.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/jnienv.cpp b/src/jnienv.cpp index f8a0ff3987..2a70b10855 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -3370,12 +3370,21 @@ PushLocalFrame(Thread* t, jint capacity) uint64_t popLocalFrame(Thread* t, uintptr_t* arguments) { - object result = *reinterpret_cast(arguments[0]); - PROTECT(t, result); + uint64_t r; + jobject presult = reinterpret_cast(arguments[0]); + if(presult != NULL) { + object result = *presult; + PROTECT(t, result); - t->m->processor->popLocalFrame(t); - - return reinterpret_cast(makeLocalReference(t, result)); + t->m->processor->popLocalFrame(t); + + r = reinterpret_cast(makeLocalReference(t, result)); + } else { + t->m->processor->popLocalFrame(t); + r = 0; + } + + return r; } jobject JNICALL