IndexOutOfBounds abgefangen
This commit is contained in:
parent
b4b1baa5ac
commit
6037240052
@ -45,9 +45,14 @@ struct ContentView: View {
|
|||||||
|
|
||||||
switch direction {
|
switch direction {
|
||||||
case MoveCommandDirection.down:
|
case MoveCommandDirection.down:
|
||||||
newIndex += 1
|
let max = self.fileList.count
|
||||||
|
if (newIndex + 1) < max {
|
||||||
|
newIndex += 1
|
||||||
|
}
|
||||||
case MoveCommandDirection.up:
|
case MoveCommandDirection.up:
|
||||||
newIndex -= 1
|
if (newIndex - 1) >= 0 {
|
||||||
|
newIndex -= 1
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
newIndex += 0
|
newIndex += 0
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user