Commit d6f71b4b authored by Felix Paul Kühne's avatar Felix Paul Kühne

ATV: prevent potential runtime exceptions

(cherry picked from commit 8a852a55)
parent 72f2c7f1
...@@ -158,9 +158,12 @@ ...@@ -158,9 +158,12 @@
return nil; return nil;
} }
NSString *ret; NSString *ret = nil;
@synchronized(_recentURLs) { @synchronized(_recentURLs) {
ret = _recentURLs[indexPathToDelete.item]; NSInteger index = indexPathToDelete.item;
if (index < _recentURLs.count) {
ret = _recentURLs[index];
}
} }
return ret; return ret;
} }
......
...@@ -222,9 +222,12 @@ ...@@ -222,9 +222,12 @@
return nil; return nil;
} }
NSString *ret; NSString *ret = nil;
@synchronized(_discoveredFiles) { @synchronized(_discoveredFiles) {
ret = _discoveredFiles[indexPathToDelete.item]; NSInteger index = indexPathToDelete.item;
if (index < _discoveredFiles.count) {
ret = _discoveredFiles[index];
}
} }
return ret; return ret;
} }
......
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