mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1366352 - Post: check anchor is set before trying to show GeckoPopupMenu r=nechen
This means we'll at least see a sensible exception, instead of an NPE when no anchor is set. That makes it easier to debug cases where no anchor was set (see e.g. the main commit from this bug). MozReview-Commit-ID: CzsZaHvnZ6y --HG-- extra : rebase_source : 2aaf737b49367d9e70fc62a1226e038c79f573e3
This commit is contained in:
parent
f9367a3210
commit
657c2807d0
@ -137,6 +137,10 @@ public class GeckoPopupMenu implements GeckoMenu.Callback,
|
||||
* Show the inflated menu.
|
||||
*/
|
||||
public void show() {
|
||||
if (mAnchor == null) {
|
||||
throw new IllegalStateException("GeckoPopupMenu.show() called without preceeding call to setAnchor()");
|
||||
}
|
||||
|
||||
if (!mMenuPopup.isShowing())
|
||||
mMenuPopup.showAsDropDown(mAnchor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user