Skip to content

Commit

Permalink
null fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Dec 22, 2021
1 parent 5540199 commit 111a33f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ARKBreedingStats/raising/ParentStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ParentStats()
for (int s = 0; s < values.Values.STATS_COUNT; s++)
{
ParentStatValues psv = new ParentStatValues();
psv.StatName = Utils.StatName(s, true) + (Utils.Precision(s) == 1 ? "" : " %");
psv.StatName = Utils.StatName(s, true) + (Utils.Precision(s) == 1 ? string.Empty : " %");
_parentStatValues.Add(psv);
flowLayoutPanel1.SetFlowBreak(psv, true);
}
Expand All @@ -42,12 +42,12 @@ public void Clear()
{
for (int s = 0; s < values.Values.STATS_COUNT; s++)
_parentStatValues[s].setValues();
_lbLevel.Text = "";
_lbLevel.Text = string.Empty;
}

public void SetParentValues(Creature mother, Creature father)
{
if (mother == null && father == null)
if (mother?.Species == null && father?.Species == null)
{
labelMother.Text = Loc.S("Unknown");
labelFather.Text = Loc.S("Unknown");
Expand Down Expand Up @@ -87,7 +87,7 @@ public void SetParentValues(Creature mother, Creature father)
);
}
labelMother.Text = mother == null ? Loc.S("Unknown") : mother.name;
labelFather.Text = father == null ? Loc.S("Unknown") : (labelMother.Width > 78 ? "\n" : "") + father.name;
labelFather.Text = father == null ? Loc.S("Unknown") : (labelMother.Width > 78 ? "\n" : string.Empty) + father.name;
if (mother != null && father != null)
{
int minLv = 1, maxLv = 1;
Expand All @@ -107,7 +107,7 @@ public void SetParentValues(Creature mother, Creature father)
_lbLevel.Text = string.Format(Loc.S("possibleLevelRange"), minLv, maxLv);
}
else
_lbLevel.Text = "";
_lbLevel.Text = string.Empty;
}

public void SetLocalizations()
Expand Down

0 comments on commit 111a33f

Please sign in to comment.