AnthonyZJiang / D-OS-Save-Editor

A save editor for Divinity Original Sin: Enhanced Edition
Other
50 stars 15 forks source link

null reference exception when non-item node has a parent id of an inventory id #10

Closed AnthonyZJiang closed 6 years ago

AnthonyZJiang commented 6 years ago

I am not entirely sure the cause, but it seems the 167805358 is an inventory id and is passed to ParseItem to be processed, which then causes null reference exception because it does not have all the properties a standard item has.

 ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   en D_OS_Save_Editor.LsxParser.ParseItem(XmlNode node)
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   --- Fin del seguimiento de la pila de la excepción interna ---
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   en System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   en System.Threading.Tasks.Task.InnerInvoke()
   en System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   en System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
   --- Fin del seguimiento de la pila de la excepción interna ---
   en System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   en System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   en System.Threading.Tasks.Task.Wait()
   en System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   en System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_0.<ParsePlayer>b__0(Int32 i)
   en System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   en System.Threading.Tasks.Task.InnerInvoke()
   en System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   en System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )
---> (Nº de excepción interna 0) D_OS_Save_Editor.ItemParserException: Item XML:

<node id="MapValue">
  <attribute id="Parent" value="167805358" type="5" />
  <attribute id="ViewId" value="0" type="27" />
  <children>
    <node id="Items">
      <attribute id="Object" value="67145133" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67145134" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67145135" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67145136" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67143295" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67143039" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67145138" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67143026" type="5" />
    </node>
    <node id="Items">
      <attribute id="Object" value="67143027" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67145133" type="5" />
      <attribute id="MapValue" value="0" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67145134" type="5" />
      <attribute id="MapValue" value="1" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67143026" type="5" />
      <attribute id="MapValue" value="7" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67145135" type="5" />
      <attribute id="MapValue" value="2" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67143027" type="5" />
      <attribute id="MapValue" value="8" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67145136" type="5" />
      <attribute id="MapValue" value="3" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67145138" type="5" />
      <attribute id="MapValue" value="6" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67143295" type="5" />
      <attribute id="MapValue" value="4" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67143039" type="5" />
      <attribute id="MapValue" value="5" type="5" />
    </node>
  </children>
</node>

 ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   en D_OS_Save_Editor.LsxParser.ParseItem(XmlNode node)
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   --- Fin del seguimiento de la pila de la excepción interna ---
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   en System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   en System.Threading.Tasks.Task.InnerInvoke()
   en System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   en System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---

---> (Nº de excepción interna 1) D_OS_Save_Editor.ItemParserException: Item XML:

<node id="MapValue">
  <attribute id="Parent" value="167805358" type="5" />
  <attribute id="ViewId" value="26" type="27" />
  <children>
    <node id="Items">
      <attribute id="Object" value="67145131" type="5" />
    </node>
    <node id="Indices">
      <attribute id="MapKey" value="67145131" type="5" />
      <attribute id="MapValue" value="0" type="5" />
    </node>
  </children>
</node>

 ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   en D_OS_Save_Editor.LsxParser.ParseItem(XmlNode node)
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   --- Fin del seguimiento de la pila de la excepción interna ---
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   en System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   en System.Threading.Tasks.Task.InnerInvoke()
   en System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   en System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---

---> (Nº de excepción interna 2) D_OS_Save_Editor.ItemParserException: Item XML:

<node id="MapValue">
  <attribute id="Parent" value="167805358" type="5" />
  <attribute id="ViewId" value="19" type="27" />
</node>

 ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   en D_OS_Save_Editor.LsxParser.ParseItem(XmlNode node)
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   --- Fin del seguimiento de la pila de la excepción interna ---
   en D_OS_Save_Editor.LsxParser.<>c__DisplayClass2_1.<ParsePlayer>b__1(Int32 j)
   en System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   en System.Threading.Tasks.Task.InnerInvoke()
   en System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   en System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<---
<---

v1.5.4
Greavox commented 6 years ago

Maybe it's an item from a mod...

AnthonyZJiang commented 6 years ago

@Greavox commented on May 11, 2018, 9:11 PM GMT+1:

Maybe it's an item from a mod...

The reporter mentioned this was a new game. I'm not sure if this is only limited to a new game or not.

But I don't think it is an item because its the parent node has an id of MapValue. Somehow it has a parent attribute with a value identical to an InventoryId. I have made a workaround to this issue. Nodes without a complete set of attributes of an item are ignored.

AnthonyZJiang commented 6 years ago

The unpublished patch didn't solve the problem. Quoting the user reported the issue:

nop now when i click load stop working and its closes

AnthonyZJiang commented 6 years ago

Savegame file requested. Let's see if the user would like to help further :)

Greavox commented 6 years ago

I'm waiting with you ^^

AnthonyZJiang commented 6 years ago

The user is willing to help. Awesome!

DEATH.zip

A new patch has been made. It was a careless mistake in the previous patch. Patched version has been sent to the user.

AnthonyZJiang commented 6 years ago

The patch does not fully work for the user. He can now edit the savegame, but the edited savegame can't be loaded because the game says it is corrupted. I have received a copy of the savegames from the user. In the zip file new save original is the unedited savegame and new save after is the edited and "corrupted" one. My game loads the edited savegame with no problem.

I have compared the lsv files and the lsx files. The differences suggest the changes1 have been correctly applied by the SE.

The lsv files are compared in CMD with fc /b file1 file2, and the differences are:

The lsx files are compared with NotePad++ and a Compare plugin V2.0.0, and differences are found in two places:

According to the user, also confirmed with the Meta file, no mod are used. However, I noticed his game version is 2.0.98.842, instead of the current steam version 2.0.119.430. Not really know what I can do about this.

1 Changing the Attribute points for both characters from 0 to 8.

wawba commented 6 years ago

hi im cesar the user of that issue

AnthonyZJiang commented 6 years ago

@wawba commented on May 21, 2018, 4:16 PM GMT+1:

hi im cesar the user of that issue

Hi, welcome to Github! Have you tried upgrading your game to the lastest steam version?

wawba commented 6 years ago

hi, no because i download from compucalitv.com