Ver Fonte

Don't continue deserialization if scene is too new

habeebweeb há 3 anos atrás
pai
commit
77edd31a7b
1 ficheiros alterados com 7 adições e 0 exclusões
  1. 7 0
      src/MeidoPhotoStudio.Plugin/MeidoPhotoStudio.cs

+ 7 - 0
src/MeidoPhotoStudio.Plugin/MeidoPhotoStudio.cs

@@ -140,6 +140,13 @@ namespace MeidoPhotoStudio.Plugin
 
             var metadata = SceneMetadata.ReadMetadata(headerReader);
 
+            if (metadata.Version > sceneVersion)
+            {
+                Utility.LogWarning("Cannot load scene. Scene is too new.");
+                Utility.LogWarning($"Your version: {sceneVersion}, Scene version: {metadata.Version}");
+                return;
+            }
+
             using var uncompressed = memoryStream.Decompress();
             using var dataReader = new BinaryReader(uncompressed, Encoding.UTF8);