From d04c68b915f0f3b2995705aaac4dabac8b3bc35e Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 22 Apr 2023 10:39:18 +0200 Subject: [PATCH] Update raygui.h --- src/raygui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index 633e169..158a348 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -1775,7 +1775,7 @@ bool GuiLabelButton(Rectangle bounds, const char *text) // NOTE: We force bounds.width to be all text float textWidth = (float)GetTextWidth(text); - if ((bounds.width - 2*GuiGetStyle(LABEL, BORDER_WIDTH) - 2*GuiGetStyle(LABEL, TEXT_PADDING)) < textWidth) bounds.width = textWidth + 2*GuiGetStyle(LABEL, BORDER_WIDTH) + 2*GuiGetStyle(LABEL, TEXT_PADDING); + if ((bounds.width - 2*GuiGetStyle(LABEL, BORDER_WIDTH) - 2*GuiGetStyle(LABEL, TEXT_PADDING)) < textWidth) bounds.width = textWidth + 2*GuiGetStyle(LABEL, BORDER_WIDTH) + 2*GuiGetStyle(LABEL, TEXT_PADDING) + 2; // Update control //-------------------------------------------------------------------- @@ -3798,7 +3798,7 @@ static int GetTextWidth(const char *text) { if (text[0] == '#') { - for (int i = 1; (text[i] != '\0') && (i < 5); i++) + for (int i = 1; (i < 5) && (text[i] != '\0'); i++) { if (text[i] == '#') {