[TIMOB-20428] Even if the xml node attributes from Titanium.XML.Entity.getAttributes( ) is not null, calling length on it cause an exception
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | None |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | Kai Lu |
| Assignee | Unknown |
| Created | 2016-01-09T12:04:33.000+0000 |
| Updated | 2018-02-28T19:55:55.000+0000 |
Description
Error: error calling getLength() on (null) NamedNodeMap
Code:
self.getElementId = function(oElem) {
var attrs = oElem.getAttributes();
if(attrs != null){
for (var k = attrs.length - 1; k >= 0; k--) {
var attr = attrs.item(k);
log("attribute name: %s, attribute value: %s", attr.name, attr.value);
if(attr.name === "id"){
return attr.value;
}
}
}
};
for (var k = attrs.length - 1; k >= 0; k--) { ==> this line cause the trouble
No comments