]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix store refunds (#26173)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sat, 16 Mar 2024 14:06:17 +0000 (01:06 +1100)
committerGitHub <noreply@github.com>
Sat, 16 Mar 2024 14:06:17 +0000 (01:06 +1100)
Content.Server/Store/Systems/StoreSystem.Ui.cs

index a7490fd27ff99cd7bd7bc0105fc214308467351d..25b1cd1f6c0f2ac8ddcbe0ebb92ff906f2b53f79 100644 (file)
@@ -323,7 +323,7 @@ public sealed partial class StoreSystem
         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];
 
@@ -332,7 +332,7 @@ public sealed partial class StoreSystem
 
             component.BoughtEntities.RemoveAt(i);
 
-            if (_actions.TryGetActionData(purchase, out var actionComponent))
+            if (_actions.TryGetActionData(purchase, out var actionComponent, logError: false))
             {
                 _actionContainer.RemoveAction(purchase, actionComponent);
             }
@@ -340,6 +340,8 @@ public sealed partial class StoreSystem
             EntityManager.DeleteEntity(purchase);
         }
 
+        component.BoughtEntities.Clear();
+
         foreach (var (currency, value) in component.BalanceSpent)
         {
             component.Balance[currency] += value;