Skip to content

Commit

Permalink
Fix crash when drawing without having saved any gestures
Browse files Browse the repository at this point in the history
  • Loading branch information
julKali committed Aug 23, 2020
1 parent 8122bae commit d07ce59
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
/release
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.julkali.glauncher"
minSdkVersion 28
targetSdkVersion 28
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ClosestGestureFinder(
val takeCount = ceil(candidateDists.size.toDouble() / 2).toInt()
val betterHalf = candidateDists.sortedByDescending { it.dist }.take(takeCount)
if (coarseLevel == maxCoarseLevel - 1) {
val first = betterHalf.first()
val first = betterHalf.firstOrNull() ?: continue
best = if (first.dist >= MIN_SCORE_THRESHOLD) first.cand else null
}
candidates = betterHalf.map { Pair(it.cand, it.coords) }
Expand Down

0 comments on commit d07ce59

Please sign in to comment.