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

Commit 3ca5d34f authored by Grace Cheng's avatar Grace Cheng
Browse files

Prevent NPE when retrieving sensor properties

Prevent NullPointerException thrown when null SensorPropertiesInternal
object was passed to the SensorPropertiesInternal#from()

Flag: EXEMPT bug-fix
Test: atest BiometricServiceTest
Fixes: 433865328
Change-Id: Ibeaa04b17bfe3183a2cdedbd4c82ac314b71d2be
parent 3fbe9fef
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -900,13 +900,16 @@ public class BiometricService extends SystemService {
            for (BiometricSensor sensor : mSensors) {
                // Explicitly re-create as the super class, since AIDL doesn't play nicely with
                // "List<? extends SensorPropertiesInternal> ...
                final SensorPropertiesInternal prop = SensorPropertiesInternal
                        .from(sensor.impl.getSensorProperties(opPackageName));
                SensorPropertiesInternal sensorProperties =
                        sensor.impl.getSensorProperties(opPackageName);
                if (sensorProperties != null) {
                    final SensorPropertiesInternal prop = SensorPropertiesInternal.from(
                            sensorProperties);
                    if (prop != null) {
                      sensors.add(prop);
                    }
                }

            }
            return sensors;
        }