From: Manuel Nickschas Date: Fri, 30 Nov 2007 20:44:16 +0000 (+0000) Subject: Fix that sometimes % wasn't escaped properly, triggering an assert X-Git-Tag: 0.1.0~42 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b3402ef6dd801ffb14b1d0227469d832dd7f574e Fix that sometimes % wasn't escaped properly, triggering an assert in the style engine. --- diff --git a/src/common/message.cpp b/src/common/message.cpp index 371867dd..3a8dbc62 100644 --- a/src/common/message.cpp +++ b/src/common/message.cpp @@ -149,21 +149,21 @@ void Message::format() { break; case Message::Nick: s = tr("%Dr<->"); - if(nick == text()) t = tr("%DrYou are now known as %DN%1%DN").arg(text()); - else t = tr("%Dr%DN%1%DN is now known as %DN%DU%2%DU%DN").arg(nick, text()); + if(nick == text()) t = tr("%DrYou are now known as %DN%1%DN").arg(txt); + else t = tr("%Dr%DN%1%DN is now known as %DN%DU%2%DU%DN").arg(nick, txt); break; case Message::Mode: s = tr("%Dm***"); if(nick.isEmpty()) t = tr("%DmUser mode: %DM%1%DM").arg(text()); - else t = tr("%DmMode %DM%1%DM by %DN%DU%2%DU%DN").arg(text(), nick); + else t = tr("%DmMode %DM%1%DM by %DN%DU%2%DU%DN").arg(txt, nick); break; case Message::Action: s = tr("%Da-*-"); - t = tr("%Da%DN%DU%1%DU%DN %2").arg(nick).arg(text()); + t = tr("%Da%DN%DU%1%DU%DN %2").arg(nick).arg(txt); break; default: s = tr("%De%1").arg(sender()); - t = tr("%De[%1]").arg(text()); + t = tr("%De[%1]").arg(txt); } _formattedSender = s; _formattedText = t; diff --git a/src/uisupport/uistyle.cpp b/src/uisupport/uistyle.cpp index 505fbc2f..84a40994 100644 --- a/src/uisupport/uistyle.cpp +++ b/src/uisupport/uistyle.cpp @@ -169,7 +169,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