From 32fb5bfb58c443fcdf5c8815df225127a0fab9eb Mon Sep 17 00:00:00 2001 From: hamidbsd <50081218+hamidbsd@users.noreply.github.com> Date: Wed, 27 Nov 2019 20:17:57 +0300 Subject: [PATCH] fix the crash --- nativescript-core/ui/core/view/view.android.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nativescript-core/ui/core/view/view.android.ts b/nativescript-core/ui/core/view/view.android.ts index c6a3132f2..b11f7d73b 100644 --- a/nativescript-core/ui/core/view/view.android.ts +++ b/nativescript-core/ui/core/view/view.android.ts @@ -380,11 +380,13 @@ export class View extends ViewCommon { @profile public onUnloaded() { if (this.touchListenerIsSet) { - this.nativeViewProtected.setOnTouchListener(null); this.touchListenerIsSet = false; - this.nativeViewProtected.setClickable(this._isClickable); + if (this.nativeViewProtected) { + this.nativeViewProtected.setOnTouchListener(null); + this.nativeViewProtected.setClickable(this._isClickable); + } } - + this._manager = null; this._rootManager = null; super.onUnloaded();