Skip to content

Commit

Permalink
Fix DAT crash regression.
Browse files Browse the repository at this point in the history
  • Loading branch information
GraionDilach committed May 30, 2020
1 parent ddf6443 commit 56c3b6d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions OpenRA.Game/Map/Map.cs
Expand Up @@ -851,6 +851,10 @@ public WDist DistanceAboveTerrain(WPos pos)

// Apply ramp offset
var cell = CellContaining(pos);

if (!Contains(cell))
return new WDist(pos.Z);

var offset = pos - CenterOfCell(cell);

var ramp = Ramp[cell];
Expand Down

1 comment on commit 56c3b6d

@GraionDilach
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pchote - OpenRA#17990 causes a crash if a plane flies outside of the map on an isometric world due to the Ramp lookup a few lines below throwing an IndexOutOfBoundsException. ProductionAirdrop is a definite reproduction case.

Please sign in to comment.