Fixed Skeleton Viewer NPE on load.

This commit is contained in:
Nathan Sweet 2021-02-26 11:24:50 +01:00
parent 93fe75d4b0
commit 0f518bf57d

View File

@ -118,6 +118,7 @@ public class SkeletonViewer extends ApplicationAdapter {
void loadSkeleton (final @Null FileHandle skeletonFile) { void loadSkeleton (final @Null FileHandle skeletonFile) {
if (skeletonFile == null) return; if (skeletonFile == null) return;
this.skeletonFile = skeletonFile;
try { try {
atlas = new SkeletonViewAtlas(this, skeletonFile); atlas = new SkeletonViewAtlas(this, skeletonFile);
@ -137,6 +138,7 @@ public class SkeletonViewer extends ApplicationAdapter {
ex.printStackTrace(); ex.printStackTrace();
ui.toast("Error loading skeleton: " + skeletonFile.name()); ui.toast("Error loading skeleton: " + skeletonFile.name());
lastModifiedCheck = 5; lastModifiedCheck = 5;
this.skeletonFile = null;
return; return;
} }
@ -154,7 +156,6 @@ public class SkeletonViewer extends ApplicationAdapter {
} }
}); });
this.skeletonFile = skeletonFile;
skeletonModified = skeletonFile.lastModified(); skeletonModified = skeletonFile.lastModified();
atlasModified = atlas.lastModified(); atlasModified = atlas.lastModified();
lastModifiedCheck = checkModifiedInterval; lastModifiedCheck = checkModifiedInterval;