cobolfoo / gdx-skineditor

A skin editor for libGDX
Apache License 2.0
93 stars 34 forks source link

Deleting all styles for a widget type makes skin file unsavable #14

Open AndrewFerr opened 9 years ago

AndrewFerr commented 9 years ago

If all styles for a single widget type are deleted for a project, that project becomes unsavable, at least the next time it is opened. For instance, if you delete all ImageButton styles from a project, close Skin Editor, open it again, and make a change that causes the skin file to be saved, the program crashes with the following exception:

Exception in thread "LWJGL Application" java.lang.NullPointerException
    at com.badlogic.gdx.scenes.scene2d.ui.Skin.save(Skin.java:176)
    ...

The likely cause behind this is the fact that the "save" method tries to iterate over a map of resources for each widget type; if a widget has no resources, the resource map is probably null, causing the NPE on line 176.