Merge "AChoreographer: Avoid potential NULL dereference" into rvc-dev am: 01ab4a277f
Change-Id: I3f4f1d4809d59394285f7c286a7f3f3014221161
diff --git a/libs/nativedisplay/AChoreographer.cpp b/libs/nativedisplay/AChoreographer.cpp
index ea51245..e458b2e 100644
--- a/libs/nativedisplay/AChoreographer.cpp
+++ b/libs/nativedisplay/AChoreographer.cpp
@@ -250,12 +250,12 @@
}
if (needsRegistration) {
JNIEnv* env = getJniEnv();
- jobject dmg = env->CallStaticObjectMethod(gJni.displayManagerGlobal.clazz,
- gJni.displayManagerGlobal.getInstance);
if (env == nullptr) {
- ALOGW("JNI environment is unavailable, skipping registeration");
+ ALOGW("JNI environment is unavailable, skipping registration");
return;
}
+ jobject dmg = env->CallStaticObjectMethod(gJni.displayManagerGlobal.clazz,
+ gJni.displayManagerGlobal.getInstance);
if (dmg == nullptr) {
ALOGW("DMS is not initialized yet: skipping registration");
return;