AChoreographer: Avoid potential NULL dereference
We move our nullptr check to before our dereference of the pointer. Test: TreeHugger Bug: 154874011 Change-Id: If1e51b8fb88f72b6b4cbda52543bf093e6c76ca9
This commit is contained in:
parent
7bcb89317d
commit
b66d04b0a2
1 changed files with 3 additions and 3 deletions
|
@ -250,12 +250,12 @@ void Choreographer::registerRefreshRateCallback(AChoreographer_refreshRateCallba
|
|||
}
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue