Summary
In SWLOR.Game.Server/Feature/PropertyLayoutDefinition/StarportLayoutDefinition.cs, PR #1974 added null checks to the OnSpawn callback, but the CanAccess method (called every time a player interacts with a starport terminal) has no equivalent protection. If a player is inside a starport whose parent record has been deleted or orphaned, DB.Get returns null and the subsequent property chain access throws a NullReferenceException.
Affected Code
var dbProperty = DB.Get<WorldProperty>(propertyId); // could be null
var dbBuilding = DB.Get<WorldProperty>(dbProperty.ParentPropertyId); // NullReferenceException if dbProperty is null
var cityId = dbBuilding.ParentPropertyId; // NullReferenceException if dbBuilding is null
Suggested Fix
Mirror the null guards added to OnSpawn:
if (dbProperty == null)
{
SendMessageToPC(player, "This terminal is unavailable. Please notify an administrator.");
return false;
}
var dbBuilding = DB.Get<WorldProperty>(dbProperty.ParentPropertyId);
if (dbBuilding == null)
{
SendMessageToPC(player, "This terminal is unavailable. Please notify an administrator.");
return false;
}
References
Summary
In
SWLOR.Game.Server/Feature/PropertyLayoutDefinition/StarportLayoutDefinition.cs, PR #1974 added null checks to theOnSpawncallback, but theCanAccessmethod (called every time a player interacts with a starport terminal) has no equivalent protection. If a player is inside a starport whose parent record has been deleted or orphaned,DB.Getreturns null and the subsequent property chain access throws aNullReferenceException.Affected Code
Suggested Fix
Mirror the null guards added to
OnSpawn:References
SWLOR.Game.Server/Feature/PropertyLayoutDefinition/StarportLayoutDefinition.cs