Fix NPE on create new 9 patch due to project reload

This commit is contained in:
fgnm
2020-08-08 20:07:19 +02:00
parent e8b8cafeec
commit 72716eb727
7 changed files with 5 additions and 6 deletions
@@ -53,7 +53,6 @@ public class MainPanelMediator extends SimpleMediator<MainPanel> {
break;
case NinePatchPlugin.CONVERT_TO_NINE_PATCH:
convertImageToNinePatch();
loadNinePatch();
break;
case MainPanel.SAVE_CLICKED:
Entity entity = plugin.currEditingEntity;
@@ -70,7 +69,7 @@ public class MainPanelMediator extends SimpleMediator<MainPanel> {
mainItemComponent.entityType = EntityFactory.NINE_PATCH;
TextureRegionComponent textureRegionComponent = ComponentRetriever.get(entity, TextureRegionComponent.class);
String regionName = textureRegionComponent.regionName;
NinePatchComponent ninePatchComponent = new NinePatchComponent();
NinePatchComponent ninePatchComponent = plugin.getAPI().getEngine().createComponent(NinePatchComponent.class);
ninePatchComponent.textureRegionName = regionName;
TextureAtlas.AtlasRegion newRegion = (TextureAtlas.AtlasRegion) textureRegionComponent.region;
int[] splits = {0, 0, 0, 0};