Skip to content

Commit

Permalink
Merge pull request #182 from samsmithnz/bug/nullexceptionintargeting
Browse files Browse the repository at this point in the history
Fix to return a valid name or null
  • Loading branch information
samsmithnz committed Oct 29, 2021
2 parents e977598 + 2bbcc50 commit c2c131c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Battle.Logic/Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ public void SetLocationAndRange(string[,,] map, Vector3 characterLocation, int f
public List<string> TargetCharacters { get; set; }
public string GetTargetCharacter()
{
return TargetCharacters[TargetCharacterIndex];
if (TargetCharacterIndex >= 0)
{
return TargetCharacters[TargetCharacterIndex];
}
else
{
return null;
}
}

public void NextTarget()
Expand Down

0 comments on commit c2c131c

Please sign in to comment.