Don’t crash if the click location is outside the map.

This commit is contained in:
Paul Chote
2015-03-28 17:53:40 +00:00
parent c0fa025b74
commit 57a6fff6ce

View File

@@ -118,9 +118,14 @@ namespace OpenRA.Graphics
var s = worldRenderer.ScreenPxPosition(p);
if (Math.Abs(s.X - world.X) <= ts.Width && Math.Abs(s.Y - world.Y) <= ts.Height)
{
var tile = map.MapTiles.Value[uv];
var ti = tileSet.GetTileInfo(tile);
var ramp = ti != null ? ti.RampType : 0;
var ramp = 0;
if (map.Contains(uv))
{
var tile = map.MapTiles.Value[uv];
var ti = tileSet.GetTileInfo(tile);
if (ti != null)
ramp = ti.RampType;
}
var corners = map.CellCorners[ramp];
var pos = map.CenterOfCell(uv.ToCPos(map));