diff --git a/apps/opencs/view/render/terraintexturemode.cpp b/apps/opencs/view/render/terraintexturemode.cpp index 6d682150a..40dfc9474 100644 --- a/apps/opencs/view/render/terraintexturemode.cpp +++ b/apps/opencs/view/render/terraintexturemode.cpp @@ -730,8 +730,12 @@ void CSVRender::TerrainTextureMode::setBrushShape(int brushShape) selectionCenterY += value.second; ++selectionAmount; } - selectionCenterX /= selectionAmount; - selectionCenterY /= selectionAmount; + + if (selectionAmount != 0) + { + selectionCenterX /= selectionAmount; + selectionCenterY /= selectionAmount; + } mCustomBrushShape.clear(); for (auto const& value: terrainSelection)