-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix the crash when some special urls cause the cache path return nil and crash #3740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Why Did you pass a |
The |
cachePathForKey function is nullable - (nullable NSString *)cachePathForKey:(NSString *)key,When my image url contains |
it will crash at iOS 17 and more but iOS 16 is ok |
Why But I think the fix should added to |
Can you provide a reproduce example URL ? Then we can added this to unit test |
|
Besides this change, we need a better way to calculate file path from your key (seems that This can fix the root case, or your url will never hit disk cache 😅 |
See #3744 You protect is OK and I'll merge as well (though I think after my changes, your code will never hit again) Oh, seems YYCache plugin, which use sqlite (not file system) will never return a cache path, so this is still OK. |
if filePath is nil or (null),framework will crash with this:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSPlaceholderData initWithContentsOfFile:options:maxLength:error:]: nil file argument'
at - (NSData *)dataForKey:(NSString *)key in the file Core/SDDiskCache.m