Adds test to make sure that calling IComponent.HandleComponentState() with null states does not throw an exception.

Fixes state handling code on components to not throw exceptions when called with null components.
This commit is contained in:
Acruid
2020-02-09 02:28:47 -08:00
parent b554d8cc8c
commit d16f433f45
8 changed files with 96 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.GameObjects;
@@ -26,7 +26,8 @@ namespace Content.Client.GameObjects.Components
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
var cast = (WelderComponentState) curState;
if (!(curState is WelderComponentState cast))
return;
FuelCapacity = cast.FuelCapacity;
Fuel = cast.Fuel;