Skip to content

Commit 58a49e8

Browse files
DivineDominionEcona77
authored andcommitted
fix hashValue crash (#24)
1 parent bd5383d commit 58a49e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/KeyHolder/RecordView.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,14 @@ public protocol RecordViewDelegate: class {
264264
let shiftTapped = inputModifiers.contains(.shift)
265265
let controlTapped = inputModifiers.contains(.control)
266266
let optionTapped = inputModifiers.contains(.option)
267-
let totalHash = commandTapped.intValue + optionTapped.intValue + shiftTapped.intValue + controlTapped.intValue
268-
if totalHash > 1 {
267+
let modifiersCount = [commandTapped, optionTapped, shiftTapped, controlTapped]
268+
.filter { $0 == true }
269+
.count
270+
if modifiersCount > 1 {
269271
multiModifiers = true
270272
return
271273
}
272-
if multiModifiers || totalHash == 0 {
274+
if multiModifiers || modifiersCount == 0 {
273275
multiModifiers = false
274276
return
275277
}

0 commit comments

Comments
 (0)