Skip to content

Commit fae5a12

Browse files
committed
Ensure that nil attributes are not improperly used
1 parent 54e15e4 commit fae5a12

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Foundation/NSXMLElement.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ public class NSXMLElement : NSXMLNode {
159159
*/
160160
public func attributeForName(name: String) -> NSXMLNode? {
161161
let attribute = _CFXMLNodeHasProp(_xmlNode, name)
162+
if attribute == nil { return nil }
162163
return NSXMLNode._objectNodeForNode(attribute)
163164
}
164165

0 commit comments

Comments
 (0)