NPE in Touchkit

I’m getting NPE from NavigationButton’s detach method. Looks like no check for null value is there in the code if the no NavigationManager exists as the parent:

public void detach() { if (componentAttachListener != null) { getNavigationManager().removeComponentAttachListener( componentAttachListener); } super.detach(); } May have to be changed to:

    public void detach() {
        if (componentAttachListener != null) {
            NavigationManager nm = getNavigationManager();
            if (nm != null) {
                nm.removeComponentAttachListener(componentAttachListener);
            }
        }
        super.detach();
    }

I wonder in which situation this occurs. A navigation button is supposed to be used together with a navigation manager, so if used that way, an NPE should not occur in normal circumstances.

Yes, it was some bad coding by me. Unfortunately, I fixed some other errors and this also went away. (Sorry, it happened in the middle of a lot of coding!) Currently, I am not able to reprduce it.