Skip to content

Null reference exception in view.android.onUnloaded #8153

Closed

Description

@hamidbsd

public onUnloaded() {
if (this.touchListenerIsSet) {
this.nativeViewProtected.setOnTouchListener(null);
this.touchListenerIsSet = false;
this.nativeViewProtected.setClickable(this._isClickable);
}

this.nativeViewProtected.setOnTouchListener(null); would throw if nativeViewProtected is null.
this.nativeViewProtected.setClickable(this._isClickable); would throw if nativeViewProtected is null.

Activity

  1. NickIliev commented on Dec 2, 2019

    @NickIliev
    Contributor

    @hamidbsd Are you using a specific component/layout or something from the core modules? Please consider creating a demo project or Playground that demonstrates your scenario. In the context of all core modules, there should be a valid native view reference when this code is called.

  2. hamidbsd commented on Dec 2, 2019

    @hamidbsd
    ContributorAuthor

    @NickIliev I am using nativescript-material-bottomsheet plugin and this is where @farfromrefug thinks the bug is.
    Please see this: #8038
    I happens when there are active button(s) on the bottomsheet and it gets dismissed.
    Simple project to reproduce:
    https://www.dropbox.com/s/m1weedpegpo0rlv/Bottomsheet%20crashing.zip?dl=0

  3. NickIliev commented on Dec 2, 2019

    @NickIliev
    Contributor

    @hamidbsd I saw the discussion that you had with @farfromrefug and it sounds legit. Marking the issue with good-first-issue as the fix sounds like a one-liner (adding a null check).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions