emanzione / PATCH

The PATCH repository for issues tracking, wiki and shared material.
https://assetstore.unity.com/packages/tools/utilities/p-a-t-c-h-ultimate-patching-system-41417
MIT License
47 stars 7 forks source link

'MHLab.Patch.Admin launcherUpdate' failed for new launcher update (not first launcher) #57

Closed micromang closed 1 year ago

micromang commented 1 year ago

I tried 'MHLab.Patch.Admin launcherUpdate' on commandline for new launcher but failed and a new update_index.json is not created. (it's not for first launcher)

From what I've tested, it works fine when a new file is added or an existing file is changed in the new launcher, but it fail when the existing file is deleted.

The MHLab.Patch.Admin version is 2.6.3.

Here is the command failure message:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at MHLab.Patch.Core.Serializing.JsonNode.Escape(String aText)
   at MHLab.Patch.Core.Serializing.JsonString.WriteToStringBuilder(StringBuilder aSB, Int32 aIndent, Int32 aIndentInc, JsonTextMode aMode)
   at MHLab.Patch.Core.Serializing.JsonObject.WriteToStringBuilder(StringBuilder aSB, Int32 aIndent, Int32 aIndentInc, JsonTextMode aMode)
   at MHLab.Patch.Core.Serializing.JsonArray.WriteToStringBuilder(StringBuilder aSB, Int32 aIndent, Int32 aIndentInc, JsonTextMode aMode)
   at MHLab.Patch.Core.Serializing.JsonObject.WriteToStringBuilder(StringBuilder aSB, Int32 aIndent, Int32 aIndentInc, JsonTextMode aMode)
   at MHLab.Patch.Core.UpdaterDefinition.ToJson()
   at MHLab.Patch.Core.Serializing.JsonUtility.ToJson[TObject](TObject obj)
   at MHLab.Patch.Admin.Serializing.JsonSerializer.Serialize[TObject](TObject obj)
   at MHLab.Patch.Core.Admin.UpdaterBuilder.Build()
   at MHLab.Patch.Admin.Commands.LauncherUpdateCommand.Handle()
   at MHLab.Patch.Admin.Program.<>c.<Main>b__0_4(LauncherUpdateCommand c)
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at MHLab.Patch.Admin.Program.Main(String[] args)
emanzione commented 1 year ago

Nice spot! I reproduced the bug on my end at the first try.

It's now solved and I also improved the updater_index.json generation, by removing some fields from the serialization when they are not needed.

The fix will be included in the next release!