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