Merge "Fix NullPointerException in SmartAutoRotateCameraStateController" into sc-dev
diff --git a/src/com/android/settings/display/SmartAutoRotateCameraStateController.java b/src/com/android/settings/display/SmartAutoRotateCameraStateController.java
index 9e2a784..a17a903 100644
--- a/src/com/android/settings/display/SmartAutoRotateCameraStateController.java
+++ b/src/com/android/settings/display/SmartAutoRotateCameraStateController.java
@@ -44,7 +44,9 @@
         super(context, key);
         mPrivacyManager = SensorPrivacyManager.getInstance(context);
         mPrivacyManager.addSensorPrivacyListener(CAMERA, (sensor, enabled) -> {
-            mPreference.setVisible(enabled);
+            if (mPreference != null) {
+                mPreference.setVisible(enabled);
+            }
             updateState(mPreference);
         });
     }