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

Commit a08c9f52 authored by Peng Xu's avatar Peng Xu
Browse files

Fix potential crash when getSensorList returns error

bug: b/19937981

Change-Id: Ibfb8c625609923b4e60fa73685dbeb10944ab2b9
parent 73ebd130
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -205,8 +205,8 @@ nativeGetSensorAtIndex(JNIEnv *env, jclass clazz, jlong sensorManager, jobject s
    SensorManager* mgr = reinterpret_cast<SensorManager*>(sensorManager);

    Sensor const* const* sensorList;
    size_t count = mgr->getSensorList(&sensorList);
    if (size_t(index) >= count) {
    ssize_t count = mgr->getSensorList(&sensorList);
    if (ssize_t(index) >= count) {
        return false;
    }