OSDN Git Service

Fix NPE caused by insets never being set
authorDoris Liu <tianliu@google.com>
Fri, 3 May 2013 18:44:45 +0000 (11:44 -0700)
committerDoris Liu <tianliu@google.com>
Fri, 3 May 2013 18:44:45 +0000 (11:44 -0700)
Bug: 8804054
Change-Id: Ie0f2dec9681977621ba95650aa714b0733a30858

src/com/android/camera/ui/CameraRootView.java

index 0cff144..e49ac59 100644 (file)
@@ -89,12 +89,14 @@ public class CameraRootView extends RelativeLayout {
                 left += mOffset;
                 break;
         }
-        if (mCurrentInsets.right > 0) {
-            // navigation bar on the right
-            right = right > 0 ? right : mCurrentInsets.right;
-        } else {
-            // navigation bar on the bottom
-            bottom = bottom > 0 ? bottom : mCurrentInsets.bottom;
+        if (mCurrentInsets != null) {
+            if (mCurrentInsets.right > 0) {
+                // navigation bar on the right
+                right = right > 0 ? right : mCurrentInsets.right;
+            } else {
+                // navigation bar on the bottom
+                bottom = bottom > 0 ? bottom : mCurrentInsets.bottom;
+            }
         }
         for (int i = 0; i < getChildCount(); i++) {
             View v = getChildAt(i);