From 80624ece4d938e1b62a69f891ac059a039f1e7f6 Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 18 Jul 2025 09:38:13 +0100 Subject: [PATCH] Improved handling of null location id inside `GetRoubleValue` --- .../Extensions/LootContainerSettingsExtensions.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Extensions/LootContainerSettingsExtensions.cs b/Libraries/SPTarkov.Server.Core/Extensions/LootContainerSettingsExtensions.cs index 429273e3..a6037e33 100644 --- a/Libraries/SPTarkov.Server.Core/Extensions/LootContainerSettingsExtensions.cs +++ b/Libraries/SPTarkov.Server.Core/Extensions/LootContainerSettingsExtensions.cs @@ -10,7 +10,7 @@ namespace SPTarkov.Server.Core.Extensions public static double GetRoubleValue( this LootContainerSettings settings, int botLevel, - string locationId + string? locationId ) { var roubleTotalByLevel = GetContainerRoubleTotalByLevel( @@ -18,10 +18,18 @@ namespace SPTarkov.Server.Core.Extensions settings.TotalRubByLevel ); + if (locationId is null) + { + return roubleTotalByLevel; + } + // Get multiplier for map, use default if map not found if (!settings.LocationMultipler.TryGetValue(locationId, out var multiplier)) { - settings.LocationMultipler.TryGetValue("default", out multiplier); + if (!settings.LocationMultipler.TryGetValue("default", out multiplier)) + { + return roubleTotalByLevel; + } } return roubleTotalByLevel * multiplier;