From 19975f4a7b7a6b10846645c2595244eefd3bc931 Mon Sep 17 00:00:00 2001 From: Scott Brady Date: Sun, 27 Jan 2013 08:39:52 +0000 Subject: PagedView: Prevent NPE Change-Id: Ic8f0e1b5a5800c6da13feda2255b79b3ece852e6 --- src/com/cyanogenmod/trebuchet/PagedView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/cyanogenmod/trebuchet/PagedView.java b/src/com/cyanogenmod/trebuchet/PagedView.java index 0076b831d..667aab27a 100644 --- a/src/com/cyanogenmod/trebuchet/PagedView.java +++ b/src/com/cyanogenmod/trebuchet/PagedView.java @@ -1631,7 +1631,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected int getChildWidth(int index) { // This functions are called enough times that it actually makes a difference in the // profiler -- so just inline the max() here - final int measuredWidth = getPageAt(index).getMeasuredWidth(); + final int measuredWidth = getPageAt(index) != null ? getPageAt(index).getMeasuredWidth() : 0; final int minWidth = mMinimumWidth; return (minWidth > measuredWidth) ? minWidth : measuredWidth; } @@ -1639,7 +1639,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected int getChildHeight(int index) { // This functions are called enough times that it actually makes a difference in the // profiler -- so just inline the max() here - final int measuredHeight = getPageAt(index).getMeasuredHeight(); + final int measuredHeight = getPageAt(index) != null ? getPageAt(index).getMeasuredHeight() : 0; final int minHeight = mMinimumHeight; return (minHeight > measuredHeight) ? minHeight : measuredHeight; } -- cgit v1.2.3