diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 3affe2a0a..623bed330 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -666,6 +666,8 @@ void Editor::drawGrid(Graphics* g, const gfx::Rect& spriteBounds, const Rect& gr // Convert the "grid" rectangle to screen coordinates grid = editorToScreen(grid); + if (grid.w < 1 || grid.h < 1) + return; // Adjust for client area gfx::Rect bounds = getBounds(); diff --git a/src/app/util/render.cpp b/src/app/util/render.cpp index 51cba6c5e..152941183 100644 --- a/src/app/util/render.cpp +++ b/src/app/util/render.cpp @@ -613,6 +613,9 @@ void RenderEngine::renderCheckedBackground(Image* image, if (tile_w < zoom.apply(1)) tile_w = zoom.apply(1); if (tile_h < zoom.apply(1)) tile_h = zoom.apply(1); + if (tile_w < 1) tile_w = 1; + if (tile_h < 1) tile_h = 1; + // Tile position (u,v) is the number of tile we start in (source_x,source_y) coordinate u = (source_x / tile_w); v = (source_y / tile_h);