From 868b0d3c00c082f40c4a5b52690e11a098aa4197 Mon Sep 17 00:00:00 2001 From: Le Philousophe <lephilousophe@users.noreply.github.com> Date: Sun, 5 May 2024 15:47:09 +0200 Subject: [PATCH] GUI: Initialize _path while constructing PathWidget Without this, if PathWidget is never set, the getLabel function returns an empty Path. Thanks to athrxx for finding this and proposing a fix. --- gui/widget.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gui/widget.h b/gui/widget.h index 55edf2ffca2..60a4151eae8 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -467,6 +467,7 @@ public: StaticTextWidget(boss, x, y, w, h, scale, path.empty() ? placeholder : Common::U32String(path.toString(Common::Path::kNativeSeparator)), align, tooltip, font, Common::UNK_LANG, useEllipsis), + _path(path), _placeholder(placeholder) { } PathWidget(GuiObject *boss, int x, int y, int w, int h, const Common::Path &path, Graphics::TextAlign align, @@ -477,6 +478,7 @@ public: StaticTextWidget(boss, x, y, w, h, path.empty() ? placeholder : Common::U32String(path.toString(Common::Path::kNativeSeparator)), align, tooltip, font, Common::UNK_LANG, useEllipsis), + _path(path), _placeholder(placeholder) {} PathWidget(GuiObject *boss, const Common::String &name, const Common::Path &path, @@ -487,6 +489,7 @@ public: StaticTextWidget(boss, name, path.empty() ? placeholder : Common::U32String(path.toString(Common::Path::kNativeSeparator)), tooltip, font, Common::UNK_LANG, useEllipsis), + _path(path), _placeholder(placeholder) {} void setLabel(const Common::Path &path) { _path = path;