Skip to content

Commit

Permalink
check for nil data or json object
Browse files Browse the repository at this point in the history
  • Loading branch information
level3tjg committed Jun 19, 2024
1 parent 1eba9a2 commit 3195f09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ static void filterNode(NSMutableDictionary *node) {
return %orig;
void (^newCompletionHandler)(NSData *, NSURLResponse *, NSError *) =
^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) return completionHandler(data, response, error);
if (!data || error) return completionHandler(data, response, error);
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:nil];
error:&error];
if (!json || error) return completionHandler(data, response, error);
if ([json isKindOfClass:NSDictionary.class]) {
if (json[@"data"] && [json[@"data"] isKindOfClass:NSDictionary.class]) {
NSDictionary *data = json[@"data"];
Expand Down

0 comments on commit 3195f09

Please sign in to comment.