From fd532781639f128f9b38f3c91a0a28eb4cfed777 Mon Sep 17 00:00:00 2001 From: Misa Date: Sat, 31 Oct 2020 21:23:59 -0700 Subject: [PATCH] Add bounds check to drawgravityline() I noticed that this function didn't have a bounds check, so I added one. Just in case. --- desktop_version/src/Graphics.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index bc554900..8ec0c09d 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1455,6 +1455,12 @@ bool Graphics::Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, po void Graphics::drawgravityline( int t ) { + if (!INBOUNDS_VEC(t, obj.entities)) + { + WHINE_ONCE("drawgravityline() out-of-bounds!"); + return; + } + if (obj.entities[t].life == 0 || obj.entities[t].onentity == 1) // FIXME: Remove 'onentity == 1' when game loop order is fixed! { switch(linestate)