Bug 1354911 - Guard against null menu item names; r=sebastian
authorJim Chen <nchen@mozilla.com>
Tue, 18 Apr 2017 17:42:58 -0400
changeset 401870 d64ffb5d7192144d7f6a52b3f3e3a54f2a752690
parent 401869 b435cb7ca81ed3e0f5be26db8ff288386711e2b1
child 401871 676c7c54953cbf8fca4b629e21aeda397f251605
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1354911
milestone55.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 1354911 - Guard against null menu item names; r=sebastian Addons may give us invalid menu item names; bail instead of crashing in such cases.
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -1845,16 +1845,20 @@ public class BrowserApp extends GeckoApp
             case "Menu:Update":
                 updateAddonMenuItem(message.getInt("id") + ADDON_MENU_OFFSET,
                                     message.getBundle("options"));
                 break;
 
             case "Menu:Add":
                 final MenuItemInfo info = new MenuItemInfo();
                 info.label = message.getString("name");
+                if (info.label == null) {
+                    Log.e(LOGTAG, "Invalid menu item name");
+                    return;
+                }
                 info.id = message.getInt("id") + ADDON_MENU_OFFSET;
                 info.checked = message.getBoolean("checked", false);
                 info.enabled = message.getBoolean("enabled", true);
                 info.visible = message.getBoolean("visible", true);
                 info.checkable = message.getBoolean("checkable", false);
                 final int parent = message.getInt("parent", 0);
                 info.parent = parent <= 0 ? parent : parent + ADDON_MENU_OFFSET;
                 addAddonMenuItem(info);