Commit 07283e6a authored by Marvin Scholz's avatar Marvin Scholz Committed by David
Browse files

macosx: fix off-by-one in reload logic

When checking for the number of sections in reloadDataForNotification
an index is compared to a count, so the count must always be larger
than the index, else the index points past the last available item
leading to an assertion like this:

  *** Assertion failure in -[_NSCollectionViewCore
  animator:], …/UIFoundation/CollectionView/UICollectionView.m:7095

  *** Terminating app due to uncaught exception
  'NSInternalInconsistencyException', reason: 'attempt to delete section
  1, but there are only 1 sections before the update'
parent f1e644f1
......@@ -390,7 +390,7 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
if (_gridViewMode) {
if (self.collectionView.dataSource == self) {
NSInteger index = [_mediaSources indexOfObject:aNotification.object];
if (self.collectionView.numberOfSections >= index) {
if (self.collectionView.numberOfSections > index) {
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:index]];
} else {
[self.collectionView reloadData];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment