Simple Zombies - Crash Fix
version 1.1 (community fix)
===========================

A runtime patch for sollaholla's Simple Zombies [.NET] mod. The original
1.0.2d release (last updated January 2017, abandoned for 10 years) has a
known bug where crafting in the inventory menu can throw an unhandled
exception that permanently kills the inventory script for the rest of the
session. After that, pressing I no longer opens the menu and the menu is
unusable until the player exits to main menu and reloads the save.

This package does NOT replace the original Simple Zombies mod. It runs
alongside the original ZombiesMod.dll and hot-patches the broken code paths
at script load time using Harmony.


What is fixed in v1.1
---------------------
Three runtime patches applied via Harmony at script construction:

1. Inventory.AddItem  ----  Null-guards the `item` parameter. Original code
                             dereferenced `item.Amount` directly, throwing
                             NullReferenceException when called with a null
                             item (deserialized save, missing component, or
                             a renamed resource that ItemFromName couldn't
                             resolve). The patch makes a null `item` return
                             false instead of crashing.

2. Inventory.ProcessKeys -- Swallows exceptions inside ProcessKeys, most
                             notably the explicit `throw new
                             NullReferenceException("item")` the author
                             left in the crafting key handler. That throw
                             fires when the menu's selected item briefly
                             becomes stale (which happens routinely after
                             a craft completes and the menu redraws).

3. PlayerInventory.OnTick - Wraps the tick handler so any uncaught
                             exception from ProcessKeys / GetWater /
                             LootDeadPeds is logged via a one-shot
                             notification instead of propagating up to
                             SHVDN. Before this patch, a single thrown
                             exception aborted the script for the entire
                             session — the symptom RunningWildJr reported
                             on April 8, 2026.

Result: no more inventory-menu-dies-after-one-bad-craft. Craft as much
packaged food as you want.


Contents
--------
ZombiesMod_CrashFix.dll    Runtime patcher (5 KB). Drop in /scripts.
0Harmony.dll               Harmony 2.3.3 runtime (~2.1 MB).
                            Required by ZombiesMod_CrashFix.dll. Drop in
                            /scripts. If you already have a newer 0Harmony.dll
                            from another mod, keep the newer one.
README.txt                 This file.
CHANGELOG.txt              Per version notes.


Requirements
------------
- The ORIGINAL Simple Zombies [.NET] mod by sollaholla must be installed
  first. This Crash Fix is purely a runtime patcher and does nothing on
  its own without the original mod present.
  Source: https://www.gta5-mods.com/scripts/simple-zombies
- ScriptHookV
- ScriptHookVDotNet 2 or 3 (the original mod targets the v2 API; both work
  in the same SHVDN setup).
- The bundled 0Harmony.dll (this Crash Fix package's other DLL).


Installation
------------
1. Install the original Simple Zombies first, following sollaholla's own
   installation instructions. Confirm pressing I in-game opens the
   inventory menu.
2. Drop BOTH files from this package into
   ...\Grand Theft Auto V\scripts\:
       ZombiesMod_CrashFix.dll
       0Harmony.dll
3. Launch the game. You should see a brief green ticker:
       "Simple Zombies Crash Fix v1.1 loaded."
   That confirms the runtime patches are applied.


How to verify the fix is working
--------------------------------
1. Load a save where you have crafting access.
2. Craft packaged food, water, or any other craftable item.
3. Keep crafting past the max amount (15 for packaged food / clean water).
4. Before this fix: the menu would silently die after one bad craft and
   pressing I afterwards would do nothing until you reload.
5. With this fix: the menu shows the "There's not enough room for anymore"
   notice and stays fully functional. If a deeper exception ever does
   happen, you'll see an orange ticker like
       "Zombies inventory: recovered from NullReferenceException"
   and the menu continues to work.


Troubleshooting
---------------
"Zombies Crash Fix failed to apply: ..."
   The patcher couldn't find one of the target methods. Most likely the
   original ZombiesMod.dll isn't loaded (SHVDN log will say). Make sure
   the original Simple Zombies is installed and showing as a started
   script in ScriptHookVDotNet.log.

No ticker on game start.
   Either ZombiesMod_CrashFix.dll isn't in /scripts, or SHVDN didn't
   load it. Check ScriptHookVDotNet.log for any [ERROR] line mentioning
   ZombiesMod_CrashFix.

Conflicts with another Harmony-using mod.
   Use the newest 0Harmony.dll you have. Harmony is backwards-compatible
   across mods. If you already have $PlayerCompanion.RuntimePatching.dll
   loaded, that mod also uses Harmony and the two work fine together.


Credits
-------
Original mod:        Simple Zombies [.NET] by sollaholla
                     https://www.gta5-mods.com/scripts/simple-zombies
Crash fix:           chris22622
Runtime patching:    Harmony by Andreas Pardeike (MIT)
                     https://github.com/pardeike/Harmony

Bug surfaced by:
- RunningWildJr (April 8 2026, inventory ArgumentNullException after
  crafting overflow)
