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

View File

@@ -31,7 +31,7 @@ public class Map implements Comparable<Map>, Publishable{
/** Map width/height, shorts. */ /** Map width/height, shorts. */
public int width, height; public int width, height;
/** Preview texture. */ /** Preview texture. */
public Texture texture; public @Nullable Texture texture;
/** Build that this map was created in. -1 = unknown or custom build. */ /** Build that this map was created in. -1 = unknown or custom build. */
public int build; public int build;
/** All teams present on this map.*/ /** All teams present on this map.*/

View File

@@ -238,10 +238,13 @@ public class Maps{
} }
Pixmap pix = MapIO.generatePreview(world.tiles); Pixmap pix = MapIO.generatePreview(world.tiles);
mainExecutor.submit(() -> map.previewFile().writePng(pix));
writeCache(map); writeCache(map);
map.texture = new Texture(pix); map.texture = new Texture(pix);
mainExecutor.submit(() -> {
map.previewFile().writePng(pix);
pix.dispose();
});
} }
maps.add(map); maps.add(map);
maps.sort(); maps.sort();