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-31 18:48:54 +0900
commit91e70b1242e6e40170285bd29fdfd7c82fd45691 (patch)
treef671a68be8447795b8a3e7f171ad15ffac4e0f1e
parente2b30ad0dc6f5a369cbd1dce3f9c92ef5d801dae (diff)
downloadlibquotient-91e70b1242e6e40170285bd29fdfd7c82fd45691.tar.gz
libquotient-91e70b1242e6e40170285bd29fdfd7c82fd45691.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);
}