Skip to content

Commit

Permalink
Fix store refunds (#26173)
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth authored and DangerRevolution committed Mar 21, 2024
1 parent 830927d commit 0ef2cec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Content.Server/Store/Systems/StoreSystem.Ui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private void OnRequestRefund(EntityUid uid, StoreComponent component, StoreReque
if (!component.RefundAllowed || component.BoughtEntities.Count == 0)
return;

for (var i = component.BoughtEntities.Count; i >= 0; i--)
for (var i = component.BoughtEntities.Count - 1; i >= 0; i--)
{
var purchase = component.BoughtEntities[i];

Expand All @@ -332,14 +332,16 @@ private void OnRequestRefund(EntityUid uid, StoreComponent component, StoreReque

component.BoughtEntities.RemoveAt(i);

if (_actions.TryGetActionData(purchase, out var actionComponent))
if (_actions.TryGetActionData(purchase, out var actionComponent, logError: false))
{
_actionContainer.RemoveAction(purchase, actionComponent);
}

EntityManager.DeleteEntity(purchase);
}

component.BoughtEntities.Clear();

foreach (var (currency, value) in component.BalanceSpent)
{
component.Balance[currency] += value;
Expand Down

0 comments on commit 0ef2cec

Please sign in to comment.