Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b7ad976 authored by Lifu Tang's avatar Lifu Tang
Browse files

Added defensive code to prevent system crash

Bug: 26940611
Change-Id: I8226d1acb42ccc7d2cd910e30b47c7c63c9f490b
parent 801d4161
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -661,6 +661,16 @@ static void GeofenceMonitorStatusCallback(
    TranslateToObject(lastLocation, locationObject);
  }

  // sCallbacksObject is created when FlpHardwareProvider on Java side is
  // initialized. Sometimes the hardware may call this function before the Java
  // side is ready. In order to prevent the system crash, check whether
  // sCallbacksObj has been created. If not, simply ignore this event from
  // hardware.
  if (sCallbacksObj == NULL) {
    ALOGE("FlpHardwareProvider hasn't been initialized.");
    return;
  }

  sCallbackEnv->CallVoidMethod(
      sCallbacksObj,
      sOnGeofenceMonitorStatus,