浏览代码

Don't continue deserialization if scene is too new

habeebweeb 3 年之前
父节点
当前提交
77edd31a7b
共有 1 个文件被更改,包括 7 次插入0 次删除
  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);