From: Manuel Nickschas Date: Fri, 9 Oct 2009 16:10:31 +0000 (+0200) Subject: Don't loop indefinitely while trying to teach manners to Qt X-Git-Tag: 0.5.0~4 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b2de861297e7bb461b37ff041827c89360ecfec6 Don't loop indefinitely while trying to teach manners to Qt Fugly hack wasn't fugly enough. --- diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index e3ab1abb..b1a071b8 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -460,7 +460,7 @@ void ContentsChatItem::doLayout(QTextLayout *layout) const { // Sometimes, setNumColumns will create a line that's too long (cf. Qt bug 238249) // We verify this and try setting the width again, making it shorter each time until the lengths match. // Dead fugly, but seems to work… - for(int i = line.textLength()-1; line.textLength() > num; i--) { + for(int i = line.textLength()-1; i >= 0 && line.textLength() > num; i--) { line.setNumColumns(i); } if(num != line.textLength()) {