Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
add additional null checks in SiegeTooltipHelper.GetHeroSiegeEvent me…
Browse files Browse the repository at this point in the history
…thod to prevent a crash (#396)
  • Loading branch information
JoeFwd committed Jun 22, 2020
1 parent c102328 commit 1a4c9e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/CommunityPatch/SiegeTooltipHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ private static SiegeEvent GetHeroSiegeEvent() {
if (Hero.MainHero == null) return null;

var heroParty = Hero.MainHero.PartyBelongedTo;
if (heroParty == null)
return null;

return heroParty.BesiegedSettlement?.SiegeEvent ??
heroParty.BesiegerCamp?.SiegeEvent ??
heroParty.CurrentSettlement.SiegeEvent;
heroParty.CurrentSettlement?.SiegeEvent;
}

public static void UpdateRangedDamageToWallsTooltip(List<TooltipProperty> tooltips, float bonusDamage) {
Expand Down

0 comments on commit 1a4c9e2

Please sign in to comment.