diff --git a/src/messages/layouts/messagelayoutcontainer.cpp b/src/messages/layouts/messagelayoutcontainer.cpp index 596842d8a..b9e781869 100644 --- a/src/messages/layouts/messagelayoutcontainer.cpp +++ b/src/messages/layouts/messagelayoutcontainer.cpp @@ -419,8 +419,12 @@ void MessageLayoutContainer::addSelectionText(QString &str, int from, int to) if (first) { if (index + c > from) { - ele->addCopyTextToString(str, from - index, to - from); + ele->addCopyTextToString(str, from - index, to - index); first = false; + + if (index + c > to) { + break; + } } } else { if (index + c > to) {