From e7665ba5deb6d1658766260fc08183164dd006d5 Mon Sep 17 00:00:00 2001 From: Dmitry Orlov Date: Fri, 16 Oct 2020 06:08:59 +0300 Subject: [PATCH] Fix: Issue #3151 - text centralization --- client/widgets/TextControls.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/widgets/TextControls.cpp b/client/widgets/TextControls.cpp index 00b7a4354..e82d27ec4 100644 --- a/client/widgets/TextControls.cpp +++ b/client/widgets/TextControls.cpp @@ -367,8 +367,10 @@ CGStatusBar::CGStatusBar(int x, int y, std::string name, int maxw) OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); background = std::make_shared(name); pos = background->pos; - if(maxw < pos.w) + + if((unsigned)maxw < (unsigned)pos.w) //(insigned)-1 > than any correct value of pos.w { + //execution of this block when maxw is incorrect breaks text centralization (issue #3151) vstd::amin(pos.w, maxw); background->srcRect = new Rect(0, 0, maxw, pos.h); }