[AC-3007] Ti.XML getNamedItem on a non existing attribute throws NullPointerException on Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2011-08-11T04:33:53.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, defect |
Reporter | Ruben Fonseca |
Assignee | Tony Guntharp |
Created | 2011-07-26T09:43:00.000+0000 |
Updated | 2016-03-08T07:48:02.000+0000 |
Description
If you have a XML node, and request a non exiting attribute, Titanium Mobile crashes on Android with NullPointerException
var node = # XML node
node.attributes.getNamedItem('foo') // <-- crash
The reason is that on this line
https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/xml/src/ti/modules/titanium/xml/NamedNodeMapProxy.java#L31
you pass null to the getNodeProxy if the name doesn't exist. Then the getNodeProxy tries to call a method on it
https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/xml/src/ti/modules/titanium/xml/NodeProxy.java#L59
which causes the null pointer exception
Ruben Are you able to please provide an XML file to test this with, so the core devs have everything they need to replicate it as you see it? This will also allow them to confirm their fix works correctly. Thanks
Hi Paul. I think the bug got fixed by this ticket TIMOB-4573, specifically on this commit https://github.com/appcelerator/titanium_mobile/commit/6bcd738ce0719847c20fa4c01b26fdbe7603525a So I think you can close this ticket now. Thank you.
That's good of you to provide a follow-up. Closing, as per your request. Cheers
Closing due to inactivity.