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
parent
0cc5bb8925
commit
5dac6b2825
|
|
@ -38,10 +38,14 @@ public static class ResourceNodeInstanceOperations
|
||||||
new ResourceNodeInstanceSnapshot(key, remaining));
|
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(
|
return new ResourceNodeInstanceMutationOutcome(
|
||||||
ResourceNodeInstanceMutationKind.Denied,
|
ResourceNodeInstanceMutationKind.Denied,
|
||||||
ResourceNodeInstanceReasonCodes.NodeDepleted,
|
ResourceNodeInstanceReasonCodes.NodeDepleted,
|
||||||
current.InteractableId.Length > 0 ? current : new ResourceNodeInstanceSnapshot(key, 0));
|
current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue