diff --git a/core/java/android/view/WindowOrientationListener.java b/core/java/android/view/WindowOrientationListener.java index 3e2e92b50961e..2a76e33f94fe9 100755 --- a/core/java/android/view/WindowOrientationListener.java +++ b/core/java/android/view/WindowOrientationListener.java @@ -109,7 +109,9 @@ public abstract class WindowOrientationListener { } public void setAllow180Rotation(boolean allowed) { - mSensorEventListener.setAllow180Rotation(allowed); + if (mSensorEventListener != null) { + mSensorEventListener.setAllow180Rotation(allowed); + } } public int getCurrentRotation(int lastRotation) {