Skip to content

Commit

Permalink
Update ComLibHooks.cs
Browse files Browse the repository at this point in the history
- Fixed null reference exception in `onPathfinding_AllowSecondPass` hook.
  • Loading branch information
ilikegoodfood committed Jun 9, 2024
1 parent 2d7da9c commit f796699
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Orcs Plus/ComLibHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public override void onGraphicalUnitUpdated(GraphicalUnit graphicalUnit)

public override bool onPathfinding_AllowSecondPass(Location loc, Unit u, List<int> expectedMapLayers, List<Func<Location[], Location, Unit, List<int>, double>> pathfindingDelegates)
{
bool result = u.society is HolyOrder_Orcs orcCulture && orcCulture.orcSociety.canGoUnderground();

if (result)
if (u.society is HolyOrder_Orcs orcCulture && orcCulture.orcSociety.canGoUnderground())
{
pathfindingDelegates.Remove(CommunityLib.Pathfinding.delegate_LAYERBOUND);

return true;
}

return result;
return false;
}

public override void onGetTradeRouteEndpoints(Map map, List<Location> endpoints)
Expand Down

0 comments on commit f796699

Please sign in to comment.