summaryrefslogtreecommitdiff
path: root/src/gui/widgets/chattab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r--src/gui/widgets/chattab.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 03d1aaf78..37e94ef1b 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -346,7 +346,8 @@ void ChatTab::chatInput(const std::string &message)
// Check for item link
size_t start = msg.find('[');
- while (start + 1 < msg.size() && start != std::string::npos
+ size_t sz = msg.size();
+ while (start + 1 < sz && start != std::string::npos
&& msg[start + 1] != '@')
{
const size_t end = msg.find(']', start);
@@ -360,9 +361,8 @@ void ChatTab::chatInput(const std::string &message)
start = msg.find('[', start + 1);
}
- std::string temp("");
- if (start + 1 < msg.length() && end < msg.length()
- && end > start + 1)
+ std::string temp;
+ if (start + 1 < sz && end < sz && end > start + 1)
{
temp = msg.substr(start + 1, end - start - 1);
@@ -373,6 +373,7 @@ void ChatTab::chatInput(const std::string &message)
msg.insert(start + 1, "|");
msg.insert(start + 1, toString(itemInfo.getId()));
msg.insert(start + 1, "@@");
+ sz = msg.size();
}
}
}