fix(Core/Grids): Crash fix (#22347)

This commit is contained in:
Takenbacon 2025-06-23 05:51:50 -07:00 committed by GitHub
parent 92094eec01
commit 8dbde7a588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -172,8 +172,8 @@ namespace Acore
template<class RET_TYPE, int CENTER_VAL>
inline RET_TYPE Compute(float x, float y, float size)
{
int gx = (int)(CENTER_VAL - x / size);
int gy = (int)(CENTER_VAL - y / size);
int gx = std::max<int>(0, (CENTER_VAL - x / size));
int gy = std::max<int>(0, (CENTER_VAL - y / size));
return RET_TYPE(gx, gy);
}