Fix a crash that could happens when trying to delete multiple tracks with the metadata row selected.

This commit is contained in:
Damiano Galassi committed 2017-03-13 17:16:15 +01:00
1 parent c482bb5e8f
commit 8d5fcf9d22
1 file changed
+5 -2
+5 -2
View File
@@ -518,7 +518,8 @@ static NSDictionary *_detailMonospacedAttr;
}
if (toolbarItem == deleteTrack) {
return self.tracksTable.selectedRow > 0 && NSApp.active;
NSIndexSet *indexes = self.tracksTable.selectedRowIndexes;
return (indexes.count && ![self.tracksTable.selectedRowIndexes containsIndex:0] && NSApp.isActive);
}
if (toolbarItem == searchMetadata) {
@@ -949,7 +950,9 @@ static NSDictionary *_detailMonospacedAttr;
}
[self.tracksTable.selectedRowIndexes enumerateIndexesUsingBlock:^(NSUInteger index, BOOL *stop) {
[trackIndexes addIndex:[self trackIndexAtAtTableRow:index]];
if (index > 0) {
[trackIndexes addIndex:[self trackIndexAtAtTableRow:index]];
}
}];
[self.mp4 removeTracksAtIndexes:trackIndexes];