NEO-61: fix null snapshot on depletion deny path.

Check TryGetRemainingGathers return before using the out snapshot;
default struct had null InteractableId and threw on .Length.
pull/96/head
VinPropane 2026-05-24 15:21:37 -04:00
parent 0cc5bb8925
commit 5dac6b2825
1 changed files with 6 additions and 2 deletions

View File

@ -38,10 +38,14 @@ public static class ResourceNodeInstanceOperations
new ResourceNodeInstanceSnapshot(key, remaining));
}
store.TryGetRemainingGathers(key, out var current);
if (!store.TryGetRemainingGathers(key, out var current))
{
current = new ResourceNodeInstanceSnapshot(key, 0);
}
return new ResourceNodeInstanceMutationOutcome(
ResourceNodeInstanceMutationKind.Denied,
ResourceNodeInstanceReasonCodes.NodeDepleted,
current.InteractableId.Length > 0 ? current : new ResourceNodeInstanceSnapshot(key, 0));
current);
}
}