diff --git a/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs b/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs
index 4595f039..7f982923 100644
--- a/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs
+++ b/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs
@@ -240,21 +240,34 @@ public class CustomItemService(
/// ID of the item being created
protected void AddToLocaleDbs(Dictionary localeDetails, string newItemId)
{
+ // Validate that there's atleast one locale to use as a default
+ var defaultLocale = localeDetails.Keys.FirstOrDefault();
+ if (defaultLocale == null)
+ {
+ return;
+ }
+
var languages = databaseService.GetLocales().Languages;
foreach (var shortNameKey in languages)
{
// Get locale details passed in, if not provided by caller use first record in newItemDetails.locales
localeDetails.TryGetValue(shortNameKey.Key, out var newLocaleDetails);
- newLocaleDetails ??= localeDetails[localeDetails.Keys.FirstOrDefault()];
+ newLocaleDetails ??= localeDetails[defaultLocale];
+
+ // If there's no name defined, don't add a transformer, the mod is probably handling locales elsewhere
+ if (newLocaleDetails.Name == null)
+ {
+ continue;
+ }
if (databaseService.GetLocales().Global.TryGetValue(shortNameKey.Key, out var lazyLoad))
{
lazyLoad.AddTransformer(localeData =>
{
- localeData![$"{newItemId} Name"] = newLocaleDetails.Name!;
- localeData[$"{newItemId} ShortName"] = newLocaleDetails.ShortName!;
- localeData[$"{newItemId} Description"] = newLocaleDetails.Description!;
+ localeData![$"{newItemId} Name"] = newLocaleDetails.Name;
+ localeData[$"{newItemId} ShortName"] = newLocaleDetails.ShortName ?? "";
+ localeData[$"{newItemId} Description"] = newLocaleDetails.Description ?? "";
return localeData;
});