Skip to content

Commit

Permalink
fix of possible null-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
cadaei committed Dec 3, 2019
1 parent 2c6a786 commit dc28345
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions ARKBreedingStats/uiControls/ParentComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Creature SelectedParent
get
{
// at index 0 is the n/a
if (parentList != null && SelectedIndex > 0 && SelectedIndex - 1 < parentList.Count)
if (SelectedIndex > 0 && SelectedIndex - 1 < parentList.Count)
return parentList[SelectedIndex - 1];
return null;
}
Expand Down Expand Up @@ -69,25 +69,27 @@ public List<Creature> ParentList
Items.Clear();
Items.Add(naLabel);
int selInd = 0;
if (value == null)
{
parentList = new List<Creature>();
return;
}
parentList = value;
if (parentList != null)
for (int c = 0; c < parentList.Count; c++)
{
for (int c = 0; c < parentList.Count; c++)
string similarities = "";
string status = "";
if (parentsSimilarity != null && parentsSimilarity.Count > c)
similarities = " (" + parentsSimilarity[c] + ")";
if (parentList[c].status != CreatureStatus.Available)
{
string similarities = "";
string status = "";
if (parentsSimilarity != null && parentsSimilarity.Count > c)
similarities = " (" + parentsSimilarity[c] + ")";
if (parentList[c].status != CreatureStatus.Available)
{
status = " (" + Utils.statusSymbol(parentList[c].status) + ")";
}
Items.Add(parentList[c].name + status + similarities);
if (parentList[c].guid == _preselectedCreatureGuid)
selInd = c + 1;
status = " (" + Utils.statusSymbol(parentList[c].status) + ")";
}
SelectedIndex = selInd;
Items.Add(parentList[c].name + status + similarities);
if (parentList[c].guid == _preselectedCreatureGuid)
selInd = c + 1;
}
SelectedIndex = selInd;
}
}

Expand Down

0 comments on commit dc28345

Please sign in to comment.