shehabic / Droppy

A simple yet-powerful and fully customizable Android drop-down menu. It supports Text with/without Icons, Separators, and even fully customized views.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail dismissPopup on internal classes

javieramp opened this issue · comments

commented

This is the trace of the fail:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewGroup.removeView(android.view.View)' on a null object reference at com.shehabic.droppy.DroppyMenuPopup.dismissPopup (DroppyMenuPopup.java:155) at com.shehabic.droppy.DroppyMenuPopup.dismiss (DroppyMenuPopup.java:150) at com.shehabic.droppy.DroppyMenuPopup$2.onClick (DroppyMenuPopup.java:105)

This is the piece of code where i build DroppyMenu:

 ` if (hasAnyProducts() && productIBTN != null) {
        DroppyMenuPopup.Builder droppyBuilder = new DroppyMenuPopup.Builder(this, productIBTN);

        for (Product product : getAvailableProductList()) {
            Drawable drawable = DrawableSquare.getDrawable(this, product);
            if (drawable != null) {
                DroppyMenuItem droppyMenuItem = new DroppyMenuItem(product.getName());
                droppyMenuItem.setIcon(drawable);

                droppyBuilder.addMenuItem(droppyMenuItem)
                        .addSeparator();
            }
        }

        droppyBuilder.setOnClick(new DroppyClickCallbackInterface() {
            @Override
            public void call(View v, int id) {
                e("DroppyMenuPopup", "Clicked on: " + String.valueOf(id));

                if (hasAnyProducts()) {
                    setSelectedProduct(id);
                    setReservationDates();
                    updateBookingFragment();
                    showBusinessPrivateSelector(hasToShowSelectorPrivateBusiness());
                    refreshUsageSelectorUI();
                    reloadMapParkingsAndSetToDefaultUI();
                }
            }
        });

        droppyBuilder.build();
    }`

The occurrences are at any mobile, by example: SM-J510FN, Aquaris X5 Plus, Moto G Play, HUAWEI MLA-L11, ONEPLUS A3003, E2303, SM-G920F, Aquaris M5.5, ... and any version of Android 5.X, 6.X or 7.X.

I can't protect my project code because fail is at internal classes.
Rollbar is from time to time sending me bugs related to this and I can not do anything when I would arrive with check, in my opinion, before making the DroppyMenu dismiss check if the view is null.
Please you could do something about this so that this does not continue.

The way to reproduce this myself or the users is by repeatedly clicking on the DroppyMenuButton without time to load the contents of the DroppyButton menu.

Hi, we have released our fork which fixes this to the jcenter: compile 'io.stepuplabs.droppy:droppy:0.6.1.0'

commented

Great!