X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fuistyle.cpp;h=5d02db326f6cb92bbf2b0390edcc3f092dd70676;hp=c81131f8b17ea0c21ecd69c2803264d91f9deacc;hb=45d9ea6ed5d64eec3ca351fdcf7610c7cff3529d;hpb=5ffc2c9018aee8b11750a956e9228ed70b3413ae diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index c81131f8..5d02db32 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -5,7 +5,7 @@ * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -112,6 +112,7 @@ UiStyle::StyledText UiStyle::styleString(QString s) { fmtList.append(None); QTextLayout::FormatRange curFmtRng; curFmtRng.format = format(None); + curFmtRng.start = 0; result.formats.append(curFmtRng); int pos = 0; int length; int fgCol = -1, bgCol = -1; // marks current mIRC color @@ -169,7 +170,11 @@ UiStyle::StyledText UiStyle::styleString(QString s) { QString code = QString("%") + s[pos+1]; if(s[pos+1] == 'D') code += s[pos+2]; FormatType ftype = formatType(code); - Q_ASSERT(ftype != Invalid); + if(ftype == Invalid) { + qWarning(qPrintable(QString("Invalid format code in string: %1").arg(s))); + continue; + } + //Q_ASSERT(ftype != Invalid); length = code.length(); if(!fmtList.contains(ftype)) { // toggle it on