FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(ios): add null check to TouchGestureRecognizer (#7182) · NativeScript/NativeScript@7d3f0d9 · GitHub

Commit 7d3f0d9

Browse files
authored andcommitted
fix(ios): add null check to TouchGestureRecognizer (#7182)
1 parent d35e14e commit 7d3f0d9

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎tns-core-modules/ui/gestures/gestures.ios.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,22 +351,30 @@ class TouchGestureRecognizer extends UIGestureRecognizer {
351351

352352
touchesBeganWithEvent(touches: NSSet<any>, event: any): void {
353353
this.executeCallback(TouchAction.down, touches, event);
354-
this.view.touchesBeganWithEvent(touches, event);
354+
if (this.view) {
355+
this.view.touchesBeganWithEvent(touches, event);
356+
}
355357
}
356358

357359
touchesMovedWithEvent(touches: NSSet<any>, event: any): void {
358360
this.executeCallback(TouchAction.move, touches, event);
359-
this.view.touchesMovedWithEvent(touches, event);
361+
if (this.view) {
362+
this.view.touchesMovedWithEvent(touches, event);
363+
}
360364
}
361365

362366
touchesEndedWithEvent(touches: NSSet<any>, event: any): void {
363367
this.executeCallback(TouchAction.up, touches, event);
364-
this.view.touchesEndedWithEvent(touches, event);
368+
if (this.view) {
369+
this.view.touchesEndedWithEvent(touches, event);
370+
}
365371
}
366372

367373
touchesCancelledWithEvent(touches: NSSet<any>, event: any): void {
368374
this.executeCallback(TouchAction.cancel, touches, event);
369-
this.view.touchesCancelledWithEvent(touches, event);
375+
if (this.view) {
376+
this.view.touchesCancelledWithEvent(touches, event);
377+
}
370378
}
371379

372380
private executeCallback(action: string, touches: NSSet<any>, event: any): void {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL