aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-03-30 20:52:43 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-03-30 20:52:43 +0900
commit27c29894a77a0733085b3901297a64773069c61a (patch)
tree5ddb96749f176a89714685687eb48a5c9ea8f137
parent3401eee364d9a41f7f28f2702a4b416a11fb19bc (diff)
downloadlibquotient-27c29894a77a0733085b3901297a64773069c61a.tar.gz
libquotient-27c29894a77a0733085b3901297a64773069c61a.zip
User::nameForRoom(): null hint is not a hint
This caused the library to erroneously believe that users with no representation in other rooms have no display name even if that display name is provided for the given room.
-rw-r--r--lib/user.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/user.cpp b/lib/user.cpp
index c373a067..951ad87d 100644
--- a/lib/user.cpp
+++ b/lib/user.cpp
@@ -82,7 +82,8 @@ class User::Private
QString User::Private::nameForRoom(const Room* r, const QString& hint) const
{
// If the hint is accurate, this function is O(1) instead of O(n)
- if (hint == mostUsedName || otherNames.contains(hint, r))
+ if (!hint.isNull()
+ && (hint == mostUsedName || otherNames.contains(hint, r)))
return hint;
return otherNames.key(r, mostUsedName);
}