From aca12a301276e960e92992c8c0e6347b8e197898 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 23 Oct 2017 19:51:16 +0100 Subject: [PATCH] [server] Fix loading saves --- Nibriboard/NibriboardServer.cs | 2 +- Nibriboard/RippleSpace/Chunk.cs | 8 +++++++- Nibriboard/RippleSpace/LocationReference.cs | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Nibriboard/NibriboardServer.cs b/Nibriboard/NibriboardServer.cs index 8ebed31..97694ca 100644 --- a/Nibriboard/NibriboardServer.cs +++ b/Nibriboard/NibriboardServer.cs @@ -51,7 +51,7 @@ namespace Nibriboard FilePrefix = "Nibriboard.ClientFiles", ClientSettings = clientSettings, SpaceManager = planeManager - }, IPAddress.IPv6Any, Port); + }, IPAddress.Any, Port); } public async Task Start() diff --git a/Nibriboard/RippleSpace/Chunk.cs b/Nibriboard/RippleSpace/Chunk.cs index 66b80b7..b0ae4e9 100644 --- a/Nibriboard/RippleSpace/Chunk.cs +++ b/Nibriboard/RippleSpace/Chunk.cs @@ -221,7 +221,13 @@ namespace Nibriboard.RippleSpace } public static async Task FromStream(Plane plane, StreamReader chunkSource) { - Chunk loadedChunk = JsonConvert.DeserializeObject(await chunkSource.ReadToEndAsync()); + Chunk loadedChunk = JsonConvert.DeserializeObject( + await chunkSource.ReadToEndAsync(), + new JsonSerializerSettings() { + MissingMemberHandling = MissingMemberHandling.Ignore, + NullValueHandling = NullValueHandling.Ignore + } + ); loadedChunk.plane = plane; loadedChunk.Location.Plane = plane; foreach(DrawnLine line in loadedChunk.lines) diff --git a/Nibriboard/RippleSpace/LocationReference.cs b/Nibriboard/RippleSpace/LocationReference.cs index baf054e..20b187b 100644 --- a/Nibriboard/RippleSpace/LocationReference.cs +++ b/Nibriboard/RippleSpace/LocationReference.cs @@ -14,6 +14,9 @@ namespace Nibriboard.RippleSpace /// public ChunkReference ContainingChunk { get { + if(Plane == null) + return null; + return new ChunkReference( Plane, X / Plane.ChunkSize,