Skip to content

Commit

Permalink
fix(ios): prevent error
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Sep 26, 2024
1 parent ddf74df commit 67d096c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/https/request.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ function getData(data, encoding?) {
const nEncoding = encoding === 'ascii' ? NSASCIIStringEncoding : NSUTF8StringEncoding;
if (data.enumerateKeysAndObjectsUsingBlock || data instanceof NSArray) {
const serial = NSJSONSerialization.dataWithJSONObjectOptionsError(data, NSJSONWritingOptions.PrettyPrinted);
content = NSString.alloc().initWithDataEncoding(serial, nEncoding).toString();
content = NSString.alloc().initWithDataEncoding(serial, nEncoding)?.toString();
} else if (data instanceof NSData) {
content = NSString.alloc().initWithDataEncoding(data, nEncoding).toString();
content = NSString.alloc().initWithDataEncoding(data, nEncoding)?.toString();
} else {
content = data;
}
Expand Down

0 comments on commit 67d096c

Please sign in to comment.