Clamp y coordinate when looking up Left/RightColPix

install-platforms
Lukas Werling 2017-12-26 14:31:43 +01:00
parent 6fc5c76a2c
commit 2d7d7b86ae
1 changed files with 2 additions and 2 deletions

View File

@ -3747,11 +3747,11 @@ BYTE C4Landscape::GetBackPix(int32_t x, int32_t y) const // get landscape pixel
// Border checks
if (x < 0)
{
return p->DefaultBkgMat(p->LeftColPix[y]);
return p->DefaultBkgMat(p->LeftColPix[Clamp(y, 0, GetHeight()-1)]);
}
if (static_cast<uint32_t>(x) >= static_cast<uint32_t>(GetWidth()))
{
return p->DefaultBkgMat(p->RightColPix[y]);
return p->DefaultBkgMat(p->RightColPix[Clamp(y, 0, GetHeight()-1)]);
}
if (y < 0)
{