mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-30 03:44:18 +00:00
Don't crash on invalid Lottie json
This commit is contained in:
parent
5c94feb216
commit
ae25ca6920
@ -63,7 +63,7 @@
|
|||||||
NSData *jsonData = [[NSData alloc] initWithContentsOfFile:filePath];
|
NSData *jsonData = [[NSData alloc] initWithContentsOfFile:filePath];
|
||||||
NSDictionary *JSONObject = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData
|
NSDictionary *JSONObject = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData
|
||||||
options:0 error:&error] : nil;
|
options:0 error:&error] : nil;
|
||||||
if (JSONObject && !error) {
|
if (JSONObject && [JSONObject isKindOfClass:[NSDictionary class]] && !error) {
|
||||||
LOTComposition *laScene = [[self alloc] initWithJSON:JSONObject withAssetBundle:[NSBundle mainBundle]];
|
LOTComposition *laScene = [[self alloc] initWithJSON:JSONObject withAssetBundle:[NSBundle mainBundle]];
|
||||||
laScene.rootDirectory = [filePath stringByDeletingLastPathComponent];
|
laScene.rootDirectory = [filePath stringByDeletingLastPathComponent];
|
||||||
[[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName];
|
[[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user