roana0229 / android-xml-sorter

Android Studio & IntelliJ Plugin for sort xml by name="xxx".
Apache License 2.0
103 stars 12 forks source link

Supporting same-line comments #2

Closed mannodermaus closed 8 years ago

mannodermaus commented 8 years ago

In my dimension files, I highlight overridden & overriding resources with a comment:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="some_padding">8dp</dimen>
    <dimen name="compat_margin">16dp</dimen> <!-- Overridden by v21 -->
</resources>

When applying "Sort Xml By Name" to this file, a NullPointerException occurs:

10:14:52 Plugin Error: AndroidXmlSorter threw an uncaught NullPointerException. Disable Plugin
10:14:52 NullPointerException: null

I'm unable to see the stack trace, but it is definitely happening because of the same-line comment, since the error vanishes if I remove that part from the XML.

It's not a big issue, but maybe it makes sense to have a look into this?

roana0229 commented 8 years ago

Thanks for your report. Issue has been confirmed here.