From 08bd443c36d5693a5f14094b65d5c45faef910c4 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 19 Oct 2021 17:20:00 +0200 Subject: [PATCH] don't draw empty vertex buffers --- MLEM/Misc/StaticSpriteBatch.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MLEM/Misc/StaticSpriteBatch.cs b/MLEM/Misc/StaticSpriteBatch.cs index c4f95c3..77e9a1e 100644 --- a/MLEM/Misc/StaticSpriteBatch.cs +++ b/MLEM/Misc/StaticSpriteBatch.cs @@ -149,6 +149,8 @@ namespace MLEM.Misc { var totalIndex = 0; foreach (var buffer in this.vertexBuffers) { var tris = Math.Min(this.vertices.Count - totalIndex, buffer.VertexCount) / 4 * 2; + if (tris <= 0) + break; this.graphicsDevice.SetVertexBuffer(buffer); if (effect != null) { foreach (var pass in effect.CurrentTechnique.Passes) {