Bug 749788 - Fix some JNI code bugs. r=blassey

This commit is contained in:
Kartikaya Gupta
2012-04-28 12:55:59 -04:00
parent 68136b5a3d
commit a000679acb
2 changed files with 13 additions and 4 deletions

View File

@@ -746,7 +746,11 @@ AndroidGeckoSurfaceView::GetSurface()
jobject
AndroidGeckoSurfaceView::GetSurfaceHolder()
{
return GetJNIForThread()->CallObjectMethod(wrapped_obj, jGetHolderMethod);
JNIEnv *env = GetJNIForThread();
if (!env)
return nsnull;
return env->CallObjectMethod(wrapped_obj, jGetHolderMethod);
}
void
@@ -886,8 +890,13 @@ nsJNIString::nsJNIString(jstring jstr, JNIEnv *jenv)
return;
}
JNIEnv *jni = jenv;
if (!jni)
if (!jni) {
jni = AndroidBridge::GetJNIEnv();
if (!jni) {
SetIsVoid(true);
return;
}
}
const jchar* jCharPtr = jni->GetStringChars(jstr, NULL);
if (!jCharPtr) {