Possible crash fix with editor saving

This commit is contained in:
Anuken
2025-12-29 19:46:35 -05:00
parent c1058ec351
commit b5d77dc7cf
2 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ public class Map implements Comparable<Map>, Publishable{
/** Map width/height, shorts. */
public int width, height;
/** Preview texture. */
public Texture texture;
public @Nullable Texture texture;
/** Build that this map was created in. -1 = unknown or custom build. */
public int build;
/** All teams present on this map.*/
+4 -1
View File
@@ -238,10 +238,13 @@ public class Maps{
}
Pixmap pix = MapIO.generatePreview(world.tiles);
mainExecutor.submit(() -> map.previewFile().writePng(pix));
writeCache(map);
map.texture = new Texture(pix);
mainExecutor.submit(() -> {
map.previewFile().writePng(pix);
pix.dispose();
});
}
maps.add(map);
maps.sort();