From dc7d14163ff7ca1f9d0e52df4855479b2d1c0d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= Date: Wed, 5 Dec 2018 23:00:08 +0100 Subject: [PATCH] Fix OpenGL renderer causing infinite loop on hacked surfaces. (#8346) --- src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp index 542fc24ac3..d134ee1256 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp @@ -179,7 +179,7 @@ int32_t MaxTransparencyDepth(const RectCommandBatch& transparent) /* * Increment the depth for endpoings that intersect this interval */ - for (IntervalTree::iterator it = std::next(top_it); it != bottom_it; ++it) + for (IntervalTree::iterator it = std::next(top_it); it != bottom_it && it != std::end(y_intersect); ++it) { max_depth = std::max(max_depth, ++it->second.depth); } @@ -192,7 +192,7 @@ int32_t MaxTransparencyDepth(const RectCommandBatch& transparent) /* * Decrement the depth for endpoings that intersected this interval */ - for (IntervalTree::iterator it = std::next(top_it); it != bottom_it; ++it) + for (IntervalTree::iterator it = std::next(top_it); it != bottom_it && it != std::end(y_intersect); ++it) { --it->second.depth; }