Bug 838745 - Prevent crashing if a promo type is dropped r=bnicholson
authorMark Finkle <mfinkle@mozilla.com>
Fri, 08 Feb 2013 00:36:48 -0500
changeset 121264 ded7b4099975b7dc5e8971ef8b32ffb86af41a32
parent 121263 09796dfecc53b123917dd44e3c4f5b2f53037124
child 121265 bd3dacf4b1387affe47b7f9cd43c3d0f557838ee
push id24278
push useremorley@mozilla.com
push dateFri, 08 Feb 2013 11:01:12 +0000
treeherdermozilla-central@fcf79680a057 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs838745
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 838745 - Prevent crashing if a promo type is dropped r=bnicholson
mobile/android/base/AboutHomePromoBox.java
--- a/mobile/android/base/AboutHomePromoBox.java
+++ b/mobile/android/base/AboutHomePromoBox.java
@@ -151,17 +151,17 @@ public class AboutHomePromoBox extends T
         getAvailableTypes(new GetTypesCallback() {
             public void onGotTypes(ArrayList<Type> types) {
                 if (types.size() == 0) {
                     hide();
                     return;
                 }
 
                 // Try to maintain a promo type for the lifetime of the application
-                if (AboutHomePromoBox.sTypeIndex == -1) {
+                if (AboutHomePromoBox.sTypeIndex == -1 || AboutHomePromoBox.sTypeIndex > types.size()) {
                     AboutHomePromoBox.sTypeIndex = new Random().nextInt(types.size());
                 }
                 mType = types.get(AboutHomePromoBox.sTypeIndex);
 
                 updateViewResources();
                 setVisibility(View.VISIBLE);
             }
         });