Fix failure to load settings NBT due to new values

This commit is contained in:
zontreck 2024-08-28 17:23:26 -07:00
parent ebcad1f8fc
commit d32b4ee35a
2 changed files with 13 additions and 3 deletions

View file

@ -85,7 +85,11 @@ class Settings {
FTS = NbtUtils.readBoolean(tag, "fts"); // First Time Setup.
// FTS should be disabled by the client when sending it back to the server in a C2SApplySettingsPacket
superuser = User.deserialize(tag.get("superuser")!.asCompoundTag());
if (tag.containsKey("superuser"))
superuser = User.deserialize(tag.get("superuser")!.asCompoundTag());
if (tag.containsKey("wine_init"))
wineInitialized = NbtUtils.readBoolean(tag, "wine_init");
if (tag.containsKey("main")) {
inst = SettingsEntry.deserialize(tag.get("main")!.asCompoundTag());
@ -100,7 +104,13 @@ class Settings {
var tag = await NbtIo.read("settings.dat");
inst = SettingsEntry.deserialize(tag.get("entry") as CompoundTag);
wineInitialized = NbtUtils.readBoolean(tag, "wine_init");
if (tag.containsKey("wine_init"))
wineInitialized = NbtUtils.readBoolean(tag, "wine_init");
if (tag.containsKey("superuser"))
superuser = User.deserialize(tag.get("superuser")!.asCompoundTag());
FTS = NbtUtils.readBoolean(tag, "fts");
} catch (E) {
print("No existing settings file found, initializing default settings");

View file

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.0+39
version: 1.1.0+41
environment:
sdk: '>=3.1.4 <4.0.0'