diff options
-rw-r--r-- | macosx/NSJSONSerialization+HBAdditions.m | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/macosx/NSJSONSerialization+HBAdditions.m b/macosx/NSJSONSerialization+HBAdditions.m index 0f18eb17c..e7b981ce9 100644 --- a/macosx/NSJSONSerialization+HBAdditions.m +++ b/macosx/NSJSONSerialization+HBAdditions.m @@ -10,6 +10,9 @@ + (id)HB_JSONObjectWithUTF8String:(const char *)nullTerminatedCString options:(NSJSONReadingOptions)opt error:(NSError **)error; { + if (!nullTerminatedCString) { + return nil; + } NSData *data = [NSData dataWithBytes:nullTerminatedCString length:strlen(nullTerminatedCString)]; id result = [NSJSONSerialization JSONObjectWithData:data options:opt error:error]; return result; |