Mods / InventoryDoubleUpdateFix

Tags:
Tweak
Author:
SiiMeR
Side:
Both
Created:
May 29th 2025 at 5:47 PM
Last modified:
Jun 21st 2025 at 5:40 AM
Downloads:
4401
Latest release (for Vintage Story 1.20.11 - 1.20.12, outdated):
doubleupdatefix_1.0.4.zip  1-click install

There is an exception going around in our server that crashes the game for almost all players when it happens

It reads something like this:

System.NullReferenceException: Object reference not set to an instance of an object. at Vintagestory.Common.InventoryNetworkUtil.UpdateSlotStack(ItemSlot slot, ItemStack newStack) in VintagestoryLib\Common\GameContent\Inventory\InventoryNetworkUtil.cs:line 493 at Vintagestory.Client.NoObf.GeneralPacketHandler.HandleInventoryDoubleUpdate(Packet_Server packet) in VintagestoryLib\Client\Systems\GeneralPacketHandler.cs:line 385 at Vintagestory.Client.NoObf.ClientMain.ExecuteMainThreadTasks(Single deltaTime) in VintagestoryLib\Client\ClientMain.cs:line 786 at Vintagestory.Client.GuiScreenRunningGame.RenderToPrimary(Single dt) in VintagestoryLib\Client\MainMenu\Screens\GuiScreenRunningGame.cs:line 161 at Vintagestory.Client.ScreenManager.Render(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 695 at Vintagestory.Client.ScreenManager.OnNewFrame(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 670 at Vintagestory.Client.NoObf.ClientPlatformWindows.window_RenderFrame(FrameEventArgs e) in VintagestoryLib\Client\ClientPlatform\GameWindow.cs:line 88 at OpenTK.Windowing.Desktop.GameWindow.Run()

It has something to do with swapping items in your inventory (I suspect it might be Art of Growing that causes this), but I am unable to pinpoint the exact issue. So I have decided to create a small patch that consumes the exception and logs info about the error into the client logs. 

Is swallowing exceptions a good idea? Not at all. But it is a lot better than half the server crashing a few times every day.

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.0.4 doubleupdatefix
1.20.11 - 1.20.12
4000 Jun 21st 2025 at 5:40 AM doubleupdatefix_1.0.4.zip 1-click install

* Make it possible to install on server and have clients auto-download it

1.0.3 doubleupdatefix
1.20.6 - 1.20.7 1.20.8 - 1.20.10
289 May 29th 2025 at 6:15 PM doubleupdatefix_1.0.3.zip 1-click install

* No need to log if no exception

1.0.2 doubleupdatefix
1.20.6 - 1.20.7 1.20.8 - 1.20.10
35 May 29th 2025 at 5:58 PM doubleupdatefix_1.0.2.zip 1-click install

* Notify the player that something went wrong and they should act

1.0.1 doubleupdatefix
1.20.6 - 1.20.7 1.20.8 - 1.20.10
40 May 29th 2025 at 5:52 PM doubleupdatefix_1.0.1.zip 1-click install

* Safer logging without chance of causing another exception

1.0.0 doubleupdatefix
1.20.6 - 1.20.7 1.20.8 - 1.20.10
37 May 29th 2025 at 5:47 PM doubleupdatefix_1.0.0.zip 1-click install

* First release


2 Comments (oldest first | newest first) (threaded | flat)

SiiMeR , May 30th 2025 at 6:23 AM

Unsure. Our server is still on .10, so we don't have any test data to confirm whether this is fixed or not.

RowanSkie, May 30th 2025 at 3:24 AM

Is this needed for 1.20.11?