diff --git a/OCGumbo/OCGumbo.m b/OCGumbo/OCGumbo.m index 5a9f973..52b0a56 100644 --- a/OCGumbo/OCGumbo.m +++ b/OCGumbo/OCGumbo.m @@ -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