From 5d5c85a0225627bbd7b57fbcec3aff3b89a459b6 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 14 Dec 2024 12:46:14 +0100 Subject: [PATCH] gui/InputField: Calculate correct length for the returned StringView --- gui/libui/src/InputField.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/libui/src/InputField.cpp b/gui/libui/src/InputField.cpp index 145d20ed..586a452e 100644 --- a/gui/libui/src/InputField.cpp +++ b/gui/libui/src/InputField.cpp @@ -115,7 +115,7 @@ namespace ui StringView InputField::data() { - if (!m_data.size()) return StringView {}; - return StringView { (const char*)m_data.data(), m_data.size() }; + if (m_data.size() < 2) return StringView {}; + return StringView { (const char*)m_data.data(), m_data.size() - 1 }; } }