From ae28c9b29cdf3f88b6fc335f229aa9f4536df83c Mon Sep 17 00:00:00 2001 From: Marisa Heit Date: Sat, 5 Nov 2016 22:09:38 -0500 Subject: [PATCH] Fix divide by 0 in new wallscan functions with 1-pixel tall textures --- src/r_segs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.cpp b/src/r_segs.cpp index ae33332de6..3697222425 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1114,7 +1114,7 @@ WallscanSampler::WallscanSampler(int y1, float swal, double yrepeat, fixed_t xof // Draw a column with support for non-power-of-two ranges void wallscan_drawcol1(int x, int y1, int y2, WallscanSampler &sampler, DWORD(*draw1column)()) { - if (sampler.uv_max == 0) // power of two + if (sampler.uv_max == 0 || sampler.uv_step == 0) // power of two { int count = y2 - y1; @@ -1162,7 +1162,7 @@ void wallscan_drawcol1(int x, int y1, int y2, WallscanSampler &sampler, DWORD(*d // Draw four columns with support for non-power-of-two ranges void wallscan_drawcol4(int x, int y1, int y2, WallscanSampler *sampler, void(*draw4columns)()) { - if (sampler[0].uv_max == 0) // power of two, no wrap handling needed + if (sampler[0].uv_max == 0 || sampler[0].uv_step == 0) // power of two, no wrap handling needed { int count = y2 - y1; for (int i = 0; i < 4; i++)