Null check activityContext because the activityContext can be null when called from SearchDelegateView.
Bug: 312585134
Test: presubmit
Flag: None
Change-Id: Id31f05f0bbaa07bc8b740f6f423a66896e9de5ba
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index cbc85b6..5cdad03 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -166,12 +166,16 @@
return show(activityContext, targetRect, items, shouldAddArrow, 0 /* width */);
}
- public static <T extends Context & ActivityContext> OptionsPopupView<T> show(
- ActivityContext activityContext,
+ @Nullable
+ private static <T extends Context & ActivityContext> OptionsPopupView<T> show(
+ @Nullable ActivityContext activityContext,
RectF targetRect,
List<OptionItem> items,
boolean shouldAddArrow,
int width) {
+ if (activityContext == null) {
+ return null;
+ }
OptionsPopupView<T> popup = (OptionsPopupView<T>) activityContext.getLayoutInflater()
.inflate(R.layout.longpress_options_menu, activityContext.getDragLayer(), false);
popup.mTargetRect = targetRect;