From ed0d231d4ca34ed38d4cd3298c6d9a4a5a643785 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Fri, 19 Feb 2010 16:56:03 +0000 Subject: in jidToBareJid and jidToResource, check the presence of '/' --- source/QXmppUtils.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/QXmppUtils.cpp') diff --git a/source/QXmppUtils.cpp b/source/QXmppUtils.cpp index 52f29a44..43f028c6 100644 --- a/source/QXmppUtils.cpp +++ b/source/QXmppUtils.cpp @@ -35,12 +35,18 @@ QString jidToResource(const QString& jid) { - return jid.mid(jid.indexOf(QChar('/'))+1); + const int pos = jid.indexOf(QChar('/')); + if (pos < 0) + return QString; + return jid.mid(pos+1); } QString jidToBareJid(const QString& jid) { - return jid.left(jid.indexOf(QChar('/'))); + const int pos = jid.indexOf(QChar('/')); + if (pos < 0) + return jid; + return jid.left(pos); } QString generateStanzaHash() -- cgit v1.2.3