Skip to content

Commit

Permalink
Add null check to BlockAction text properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachHembree committed Mar 25, 2023
1 parent 0deaa42 commit dc8d2eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ private class BlockAction : BlockMemberBase, IBlockAction
{
public override string PropName => _propName;

public override StringBuilder FormattedValue { get { GetValueFunc(dispBuilder); return dispBuilder; } }
public override StringBuilder FormattedValue { get { GetValueFunc?.Invoke(dispBuilder); return dispBuilder; } }

public override StringBuilder StatusText
{
get
{
if (GetPostfixFunc != null)
{
GetPostfixFunc(statusBuilder);
GetPostfixFunc?.Invoke(statusBuilder);
return statusBuilder;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private StringBuilder GetFormattedValue()
}

private float GetThrustEffect() =>
block.Thruster.ThrustEffectiveness;
block?.Thruster?.ThrustEffectiveness ?? 0f;

private void GetPistonExtension(StringBuilder sb)
{
Expand Down

0 comments on commit dc8d2eb

Please sign in to comment.