Permalink
Browse files

Camera: Fix FC caused by IndexOutOfBounds exception in BasicIndicator

Change-Id: If8c7da1d8832a44216b8a31b3397fb5f7c40bdae
  • Loading branch information...
1 parent 4b1fb4b commit e148b60f3191c884c47e13b79407ccfb9d694439 @C3C0 committed May 24, 2012
Showing with 13 additions and 3 deletions.
  1. +9 −3 src/com/android/camera/ui/AbstractIndicator.java
  2. +4 −0 src/com/android/camera/ui/BasicIndicator.java
@@ -38,9 +38,15 @@ public AbstractIndicator(Context context) {
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
BitmapTexture icon = getIcon();
- new MeasureHelper(this)
- .setPreferredContentSize(icon.getWidth(), icon.getHeight())
- .measure(widthSpec, heightSpec);
+
+ if(icon == null)
+ new MeasureHelper(this)
+ .setPreferredContentSize(0, 0)
+ .measure(widthSpec, heightSpec);
+ else
+ new MeasureHelper(this)
+ .setPreferredContentSize(icon.getWidth(), icon.getHeight())
+ .measure(widthSpec, heightSpec);
}
@Override
@@ -106,6 +106,10 @@ public void onItemSelected(GLView view, int position) {
@Override
protected ResourceTexture getIcon() {
int index = mIndex;
+
+ if(index < 0 || index >= mIcon.length)
+ return null;
+
if (mIcon[index] == null) {
Context context = getGLRootView().getContext();
mIcon[index] = new ResourceTexture(

0 comments on commit e148b60

Please sign in to comment.