From 7c74eece99e1ec52e3022803975c92b951ec11c0 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 30 Nov 2025 14:01:59 +0300 Subject: [PATCH] fix: bad_alloc if canvas element size is negative --- src/graphics/ui/elements/Canvas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graphics/ui/elements/Canvas.cpp b/src/graphics/ui/elements/Canvas.cpp index b24066ed..4fbc2b78 100644 --- a/src/graphics/ui/elements/Canvas.cpp +++ b/src/graphics/ui/elements/Canvas.cpp @@ -22,6 +22,6 @@ void gui::Canvas::draw(const DrawContext& pctx, const Assets& assets) { void gui::Canvas::setSize(const glm::vec2& size) { UINode::setSize(size); - data->extend(size.x, size.y); + data->extend(std::max(1, size.x), std::max(1, size.y)); texture->reload(*data); }