IndexOutOfBounds abgefangen

This commit is contained in:
Gerrit Linnemann 2020-08-16 10:28:42 +02:00
parent b4b1baa5ac
commit 6037240052

View File

@ -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
}