From 27a5d20888d1be67ab55bf1c8d6077a7917abd12 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Sat, 14 Dec 2024 13:52:45 +0100 Subject: [PATCH] fix: uninitialized worlds --- .../Modes/External/WorldsController.cs | 12 ++++++------ .../Modes/Realms/Controllers/WorldsController.cs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs index f8ca150..df7fb94 100644 --- a/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/External/WorldsController.cs @@ -73,8 +73,8 @@ namespace Minecraft_Realms_Emulator.Modes.External OwnerUUID = world.OwnerUUID, Name = world.Name, Motd = world.Motd, - GameMode = activeSlot.GameMode, - IsHardcore = activeSlot.Difficulty == 3, + GameMode = activeSlot?.GameMode ?? 0, + IsHardcore = activeSlot?.Difficulty == 3, State = world.State, WorldType = world.WorldType, MaxPlayers = world.MaxPlayers, @@ -177,8 +177,8 @@ namespace Minecraft_Realms_Emulator.Modes.External OwnerUUID = world.OwnerUUID, Name = world.Name, Motd = world.Motd, - GameMode = activeSlot.GameMode, - IsHardcore = activeSlot.Difficulty == 3, + GameMode = activeSlot?.GameMode ?? 0, + IsHardcore = activeSlot?.Difficulty == 3, State = world.State, WorldType = world.WorldType, MaxPlayers = world.MaxPlayers, @@ -333,8 +333,8 @@ namespace Minecraft_Realms_Emulator.Modes.External OwnerUUID = world.OwnerUUID, Name = world.Name, Motd = world.Motd, - GameMode = activeSlot.GameMode, - IsHardcore = activeSlot.Difficulty == 3, + GameMode = activeSlot?.GameMode ?? 0, + IsHardcore = activeSlot?.Difficulty == 3, State = world.State, WorldType = world.WorldType, MaxPlayers = world.MaxPlayers, diff --git a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs index e2eaafd..18ce045 100644 --- a/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs +++ b/Minecraft-Realms-Emulator/Modes/Realms/Controllers/WorldsController.cs @@ -76,8 +76,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers OwnerUUID = world.OwnerUUID, Name = world.Name, Motd = world.Motd, - GameMode = activeSlot.GameMode, - IsHardcore = activeSlot.Difficulty == 3, + GameMode = activeSlot?.GameMode ?? 0, + IsHardcore = activeSlot?.Difficulty == 3, State = world.State, WorldType = world.WorldType, MaxPlayers = world.MaxPlayers, @@ -180,8 +180,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers OwnerUUID = world.OwnerUUID, Name = world.Name, Motd = world.Motd, - GameMode = activeSlot.GameMode, - IsHardcore = activeSlot.Difficulty == 3, + GameMode = activeSlot?.GameMode ?? 0, + IsHardcore = activeSlot?.Difficulty == 3, State = world.State, WorldType = world.WorldType, MaxPlayers = world.MaxPlayers, @@ -336,8 +336,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers OwnerUUID = world.OwnerUUID, Name = world.Name, Motd = world.Motd, - GameMode = activeSlot.GameMode, - IsHardcore = activeSlot.Difficulty == 3, + GameMode = activeSlot?.GameMode ?? 0, + IsHardcore = activeSlot?.Difficulty == 3, State = world.State, WorldType = world.WorldType, MaxPlayers = world.MaxPlayers,