(c35335f47) Fixed CharacterInfo.IncreaseSkillLevel crashing if the character has been removed, steering component stops giving xp to the user if the user is removed. Closes #1553

This commit is contained in:
Joonas Rikkonen
2019-06-09 17:44:02 +03:00
parent fdd6850743
commit 81b6d2199f
2 changed files with 6 additions and 1 deletions

View File

@@ -747,7 +747,7 @@ namespace Barotrauma
public void IncreaseSkillLevel(string skillIdentifier, float increase, Vector2 worldPos)
{
if (Job == null || (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient)) return;
if (Job == null || (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) || Character == null) { return; }
float prevLevel = Job.GetSkillLevel(skillIdentifier);
Job.IncreaseSkillLevel(skillIdentifier, increase);

View File

@@ -210,6 +210,11 @@ namespace Barotrauma.Items.Components
if (voltage < minVoltage && currPowerConsumption > 0.0f) { return; }
if (user != null && user.Removed)
{
user = null;
}
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (autoPilot)