SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit d1b4af5e76699d4ddc31be4659b8337e0b1008b8 parent eebdbbfd5b1ca4cc289dc51f5d559492640cea9a Author: Lior Halphon <LIJI32@gmail.com> Date: Wed, 12 Jun 2024 13:48:09 +0300 Catch exceptions when parsing HH JSONs, just in case Diffstat:
| M | iOS/GBHub.m | 33 | +++++++++++++++++++-------------- |
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/iOS/GBHub.m b/iOS/GBHub.m @@ -236,25 +236,30 @@ static NSURL *StringToWebURL(NSString *string) } for (NSDictionary *entry in json[@"entries"]) { - @autoreleasepool { - GBHubGame *game = [[GBHubGame alloc] initWithJSON:entry]; - if (game && !_allGames[game.slug]) { - _allGames[game.slug] = game; - bool showcase = [_showcaseExtras containsObject:game.slug]; - if (!showcase) { - for (NSString *tag in game.tags) { - _tags[tag] = @(_tags[tag].unsignedIntValue + 1); - if ([tag containsString:@"Shortlist"]) { - showcase = true; - break; + @try { + @autoreleasepool { + GBHubGame *game = [[GBHubGame alloc] initWithJSON:entry]; + if (game && !_allGames[game.slug]) { + _allGames[game.slug] = game; + bool showcase = [_showcaseExtras containsObject:game.slug]; + if (!showcase) { + for (NSString *tag in game.tags) { + _tags[tag] = @(_tags[tag].unsignedIntValue + 1); + if ([tag containsString:@"Shortlist"]) { + showcase = true; + break; + } } } - } - if (showcase) { - [_showcaseGames addObject:game]; + if (showcase) { + [_showcaseGames addObject:game]; + } } } } + @catch (NSException *exception) { + // Just in case I missed some JSON edge cases, let's not abort the entire response over one bad game + } } if ([json[@"page_current"] unsignedIntValue] == [json[@"page_total"] unsignedIntValue]) {
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.