From cd0fb7af20f855e1190122467c5650e46bfe820c Mon Sep 17 00:00:00 2001 From: Doris Liu Date: Fri, 3 May 2013 11:44:45 -0700 Subject: Fix NPE caused by insets never being set Bug: 8804054 Change-Id: Ie0f2dec9681977621ba95650aa714b0733a30858 --- src/com/android/camera/ui/CameraRootView.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/com/android/camera/ui/CameraRootView.java b/src/com/android/camera/ui/CameraRootView.java index 0cff14480..e49ac59a6 100644 --- a/src/com/android/camera/ui/CameraRootView.java +++ b/src/com/android/camera/ui/CameraRootView.java @@ -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); -- cgit v1.2.3