diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index 496dc62538..378873ec00 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -56,7 +56,7 @@ void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int stepx = 1; } - this->SetPixel(video, x, y, color); + if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color); if (dx > dy) { frac = dy - (dx / 2); while (x != x2) { diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index 4a2753af6f..a931df6248 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -60,7 +60,7 @@ void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int s stepx = 1; } - this->SetPixel(video, x, y, color); + if (x > 0 && y > 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, color); if (dx > dy) { frac = dy - (dx / 2); while (x != x2) {