null-check before derefing title in MenuItemImpl
The toString() method in MenuItemImpl returns mTitle.toString(),
which crashes when the title is null (which it can be, since there
is no requirement that a title be non-null, and you can get one
by simply not assigning a title to begin with or by setting it
to null).
Issue #13420311 MenuItemImpl can't handle a null title
Change-Id: I701d1d565f1d254ffdd41ca64c1abaf2906edb79
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index 61dcaca..3b1f20d 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -496,7 +496,7 @@
@Override
public String toString() {
- return mTitle.toString();
+ return mTitle != null ? mTitle.toString() : null;
}
void setMenuInfo(ContextMenuInfo menuInfo) {