Skip to content

Commit

Permalink
fix a crash
Browse files Browse the repository at this point in the history
[NSString stringWithUTF8String:NULL] cause crash
  • Loading branch information
Matt Cai committed Sep 14, 2018
1 parent 4ada56f commit c6947bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion OCGumbo/OCGumbo.m
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ - (OCGumboAttribute *)getAttributeNode:(NSString *)name {
}

- (NSString *)getAttribute:(NSString *)name {
return @(oc_gumbo_get_attribute(_gumboNode, [name UTF8String]));
const char *text = oc_gumbo_get_attribute(_gumboNode, [name UTF8String]);
return text ? @(text) : nil;
}

@end
Expand Down

0 comments on commit c6947bd

Please sign in to comment.