diff --git a/core/src/mindustry/io/MapIO.java b/core/src/mindustry/io/MapIO.java index 26cc9cd8ac..d918ff29b0 100644 --- a/core/src/mindustry/io/MapIO.java +++ b/core/src/mindustry/io/MapIO.java @@ -39,6 +39,7 @@ public class MapIO{ SaveIO.readHeader(stream); int version = stream.readInt(); SaveVersion ver = SaveIO.getSaveWriter(version); + if(ver == null) throw new IOException("Unknown save version: " + version + ". Are you trying to load a save from a newer version?"); StringMap tags = new StringMap(); ver.region("meta", stream, counter, in -> tags.putAll(ver.readStringMap(in))); return new Map(file, tags.getInt("width"), tags.getInt("height"), tags, custom, version, Version.build); @@ -69,6 +70,7 @@ public class MapIO{ SaveIO.readHeader(stream); int version = stream.readInt(); SaveVersion ver = SaveIO.getSaveWriter(version); + if(ver == null) throw new IOException("Unknown save version: " + version + ". Are you trying to load a save from a newer version?"); ver.region("meta", stream, counter, ver::readStringMap); Pixmap floors = new Pixmap(map.width, map.height); diff --git a/core/src/mindustry/io/SaveIO.java b/core/src/mindustry/io/SaveIO.java index dea4ce7b72..161b0681a4 100644 --- a/core/src/mindustry/io/SaveIO.java +++ b/core/src/mindustry/io/SaveIO.java @@ -32,7 +32,7 @@ public class SaveIO{ return versionArray.peek(); } - public static SaveVersion getSaveWriter(int version){ + public static @Nullable SaveVersion getSaveWriter(int version){ return versions.get(version); } diff --git a/gradle.properties b/gradle.properties index 5e1d3a2b35..65165c4661 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ org.gradle.caching=true org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 android.enableR8.fullMode=false -archash=ae3b50eaca +archash=e3a5a3a832