Skip to content

Commit cb043f3

Browse files
authored
Merge pull request #629 from DrakiaXYZ/fix-dupeitemlocale
Discard duplicate item locale entry instead of throwing an exception
2 parents 76b8111 + a98a5ce commit cb043f3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,15 @@ protected void AddToLocaleDbs(Dictionary<string, LocaleDetails> localeDetails, s
252252
{
253253
lazyLoad.AddTransformer(localeData =>
254254
{
255-
localeData.Add($"{newItemId} Name", newLocaleDetails.Name);
256-
localeData.Add($"{newItemId} ShortName", newLocaleDetails.ShortName);
257-
localeData.Add($"{newItemId} Description", newLocaleDetails.Description);
255+
if (!localeData.TryAdd($"{newItemId} Name", newLocaleDetails.Name))
256+
{
257+
logger.Error($"Error adding locale `{newItemId} Name` to {shortNameKey.Key}, duplicate key");
258+
}
259+
else
260+
{
261+
localeData.TryAdd($"{newItemId} ShortName", newLocaleDetails.ShortName);
262+
localeData.TryAdd($"{newItemId} Description", newLocaleDetails.Description);
263+
}
258264

259265
return localeData;
260266
});

0 commit comments

Comments
 (0)