From 30fd3185b578689b6a6f823eee883a0933d0c558 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Fri, 28 Jun 2024 08:23:15 +0200 Subject: [PATCH] Make handler comparator work only on non-null objects (#2964) ## Description Should close https://github.com/software-mansion/react-native-gesture-handler/issues/2960 Changes the comparator type to work only with non-null objects, since it's only used in this way. It was probably a leftover from migration to Kotlin. ## Test plan Build the app --- .../swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt b/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt index f77a24aabc..25d556f471 100644 --- a/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt +++ b/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt @@ -615,7 +615,7 @@ class GestureHandlerOrchestrator( private val matrixTransformCoords = FloatArray(2) private val inverseMatrix = Matrix() private val tempCoords = FloatArray(2) - private val handlersComparator = Comparator?> { a, b -> + private val handlersComparator = Comparator> { a, b -> return@Comparator if (a.isActive && b.isActive || a.isAwaiting && b.isAwaiting) { // both A and B are either active or awaiting activation, in which case we prefer one that // has activated (or turned into "awaiting" state) earlier