summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Brady <sbradymobile@gmail.com>2013-01-27 08:39:52 +0000
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2013-01-27 00:44:58 -0800
commit19975f4a7b7a6b10846645c2595244eefd3bc931 (patch)
treea92b0935a07f7d0bf1face56f86e3886c438e80c
parent125ab5aa2a51fb04e1d127e87551533465c14c53 (diff)
downloadandroid_packages_apps_Trebuchet-19975f4a7b7a6b10846645c2595244eefd3bc931.tar.gz
android_packages_apps_Trebuchet-19975f4a7b7a6b10846645c2595244eefd3bc931.tar.bz2
android_packages_apps_Trebuchet-19975f4a7b7a6b10846645c2595244eefd3bc931.zip
PagedView: Prevent NPE
Change-Id: Ic8f0e1b5a5800c6da13feda2255b79b3ece852e6
-rw-r--r--src/com/cyanogenmod/trebuchet/PagedView.java4
1 files 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;
}