Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c0b768e authored by Romain Guy's avatar Romain Guy
Browse files

Fix NPE when calling PopupWindow's default constructor.

Change-Id: I5317b052236d758fd3b9055c9940fbb10ec7b123
parent 02739a8e
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -392,11 +392,11 @@ public class PopupWindow {

        mContentView = contentView;

        if (mContext == null) {
        if (mContext == null && mContentView != null) {
            mContext = mContentView.getContext();
        }

        if (mWindowManager == null) {
        if (mWindowManager == null && mContentView != null) {
            mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        }
    }
@@ -939,7 +939,9 @@ public class PopupWindow {
     * @param p the layout parameters of the popup's content view
     */
    private void invokePopup(WindowManager.LayoutParams p) {
        if (mContext != null) {
            p.packageName = mContext.getPackageName();
        }
        mWindowManager.addView(mPopupView, p);
    }