Bug 723917 - NullPointerException when removing a menu item [r=sriram a=akeybl]
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 03 Feb 2012 16:18:46 -0500
changeset 88337 f68ab5b1ce7afafce5dd920f205b889c2f7789fa
parent 88336 3f61c19f697d865995bea8d6fe90bb2e810ace4d
child 88338 de903fa58268937a1d173592bdd3c433aa1558c8
push idunknown
push userunknown
push dateunknown
reviewerssriram, akeybl
bugs723917
milestone12.0a2
Bug 723917 - NullPointerException when removing a menu item [r=sriram a=akeybl]
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -897,20 +897,21 @@ abstract public class GeckoApp
             } else if (event.equals("Menu:Remove")) {
                 // remove it from the menu and from our vector
                 Iterator<ExtraMenuItem> i = sExtraMenuItems.iterator();
                 int id = message.getInt("id");
                 while (i.hasNext()) {
                     ExtraMenuItem item = i.next();
                     if (item.id == id) {
                         sExtraMenuItems.remove(item);
+                        if (sMenu == null)
+                            return;
                         MenuItem menu = sMenu.findItem(id);
                         if (menu != null)
                             sMenu.removeItem(id);
-                        return;
                     }
                 }
             } else if (event.equals("Toast:Show")) {
                 final String msg = message.getString("message");
                 final String duration = message.getString("duration");
                 handleShowToast(msg, duration);
             } else if (event.equals("DOMContentLoaded")) {
                 final int tabId = message.getInt("tabID");