From 2c4c7aa4c0252bd933f45e2ade8cd1d39c381b0a Mon Sep 17 00:00:00 2001 From: Scott_NZ Date: Fri, 19 Apr 2013 19:09:29 +1200 Subject: [PATCH] Fixes TerrainRenderer.Draw() causing a crash because of negative firstRow value --- OpenRA.Game/Graphics/TerrainRenderer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Graphics/TerrainRenderer.cs b/OpenRA.Game/Graphics/TerrainRenderer.cs index 08882935e3..3231ef4347 100644 --- a/OpenRA.Game/Graphics/TerrainRenderer.cs +++ b/OpenRA.Game/Graphics/TerrainRenderer.cs @@ -69,9 +69,6 @@ namespace OpenRA.Graphics if (lastRow < 0 || firstRow > map.Bounds.Height) return; - if (firstRow < 0) firstRow = 0; - if (lastRow > map.Bounds.Height) lastRow = map.Bounds.Height; - if (world.VisibleBounds.HasValue) { var r = world.VisibleBounds.Value; @@ -82,6 +79,9 @@ namespace OpenRA.Graphics firstRow = r.Bottom - map.Bounds.Top; } + if (firstRow < 0) firstRow = 0; + if (lastRow > map.Bounds.Height) lastRow = map.Bounds.Height; + if( lastRow < firstRow ) lastRow = firstRow; Game.Renderer.WorldSpriteRenderer.DrawVertexBuffer(