summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2019-04-02 15:47:19 -0400
committerNicoleYarroch <nicole@livio.io>2019-04-02 15:47:19 -0400
commitb067fc9a5b1af505f138918da1fdfcb14cbb9926 (patch)
tree9791e9748985283f485ad12dc3284d621afa3067
parent677703d71dadf8cc6358cc44a366f48efd2868f5 (diff)
downloadsdl_ios-bugfix/issue_1207_haptic_input_checked_on_wrong_thread.tar.gz
Added check for nil hitViewHandler in Touch Managerbugfix/issue_1207_haptic_input_checked_on_wrong_thread
* fixed documentation
-rw-r--r--SmartDeviceLink/SDLTouchManager.m6
1 files changed, 4 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLTouchManager.m b/SmartDeviceLink/SDLTouchManager.m
index 5ae0d33c3..9a66d81e4 100644
--- a/SmartDeviceLink/SDLTouchManager.m
+++ b/SmartDeviceLink/SDLTouchManager.m
@@ -430,19 +430,21 @@ static NSUInteger const MaximumNumberOfTouches = 2;
/**
* HAX to preserve the thread on which the delegate is notified for single taps; returning on the main thread would be a breaking change. All other touch gestures currently notify the delegate on the main thread. The single tap timer runs on a background thread so when a single tap is detected the hit test needs to be done on the main thread and then the result is returned on a background thread.
*
- * Checks if a single tap is inside a view. As the single tap timer is run on a background thread, the check is done on a main thread and then the result is returned on a background thread. This is done to ma
+ * Checks if a single tap is inside a view. As the single tap timer is run on a background thread, the check is done on a main thread and then the result is returned on a background thread.
*
* @param point Screen coordinates of the tap gesture
- * @param hitViewHandler A handler that returns the view the point is inside of; nil if the point does not lie inside a view
+ * @param hitViewHandler A handler that returns the view the point is inside of; nil if the point does not lie inside of a view
*/
- (void)sdl_getSingleTapHitView:(CGPoint)point hitViewHandler:(nullable void (^)(UIView * __nullable hitView))hitViewHandler {
if (!self.hitTester) {
+ if (!hitViewHandler) { return; }
return hitViewHandler(nil);
}
dispatch_async(dispatch_get_main_queue(), ^{
UIView *hitView = [self.hitTester viewForPoint:point];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ if (!hitViewHandler) { return; }
return hitViewHandler(hitView);
});
});