From 17c8e63d3a3d3e0327d6a3c4baf49dc40700df5b Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Tue, 23 May 2023 20:03:12 +0200 Subject: [PATCH] Fix invalid memory usage in stats tooltip --- apps/openmw/mwgui/tooltips.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 84fb8157a3..06fb8e10ef 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -274,14 +274,14 @@ namespace MWGui if (underscorePos == std::string::npos) continue; std::string key = userStringPair.first.substr(0, underscorePos); - std::string widgetName = userStringPair.first.substr( - underscorePos + 1, userStringPair.first.size() - (underscorePos + 1)); + std::string_view first = userStringPair.first; + std::string_view widgetName = first.substr(underscorePos + 1); type = "Property"; size_t caretPos = key.find('^'); if (caretPos != std::string::npos) { - type = key.substr(0, caretPos); + type = first.substr(0, caretPos); key.erase(key.begin(), key.begin() + caretPos + 1); }