Remove bad asserts from IRC text wrapping code (#2446)

This commit is contained in:
pajlada 2021-02-11 12:52:50 +01:00 committed by GitHub
parent 4a53472215
commit 303b079257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -611,7 +611,7 @@ void IrcTextElement::addToContainer(MessageLayoutContainer &container,
}
}
// we done goofed, we need to wrap the text
// The word does not fit on a new line, we need to wrap it
QString text = word.text;
std::vector<Segment> segments = word.segments;
int textLength = text.length();
@ -625,6 +625,7 @@ void IrcTextElement::addToContainer(MessageLayoutContainer &container,
{
if (!container.canAddElements())
{
// The container does not allow any more elements to be added, stop here
break;
}
@ -638,11 +639,10 @@ void IrcTextElement::addToContainer(MessageLayoutContainer &container,
{
std::vector<Segment> pieceSegments;
int charactersLeft = i - wordStart;
assert(charactersLeft > 0);
for (auto segmentIt = segments.begin();
segmentIt != segments.end();)
{
assert(charactersLeft > 0);
auto &segment = *segmentIt;
if (charactersLeft >= segment.text.length())
{