diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2024-06-20 16:59:14 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2024-06-20 17:00:23 +0200 |
commit | c7483aed98f6c64499a035428129fb106649f7d4 (patch) | |
tree | 2a6d61d1887c36e7680387ebb0b089828f5c5f44 /src | |
parent | Merge pull request #1748 from flexxyfluxx/patch-1 (diff) | |
download | nheko-c7483aed98f6c64499a035428129fb106649f7d4.tar.xz |
Fix crash on empty mxid in ignore commands
fixes #1753
Diffstat (limited to 'src')
-rw-r--r-- | src/timeline/InputBar.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp index 57c1263b..b8c7016d 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp @@ -1030,9 +1030,9 @@ InputBar::command(const QString &command, QString args) } else if (command == QLatin1String("converttoroom")) { utils::removeDirectFromRoom(this->room->roomId()); } else if (command == QLatin1String("ignore")) { - this->toggleIgnore(args, true); + this->toggleIgnore(args.trimmed(), true); } else if (command == QLatin1String("unignore")) { - this->toggleIgnore(args, false); + this->toggleIgnore(args.trimmed(), false); } else { return false; } @@ -1043,6 +1043,11 @@ InputBar::command(const QString &command, QString args) void InputBar::toggleIgnore(const QString &user, const bool ignored) { + if (!user.startsWith(u"@")) { + MainWindow::instance()->showNotification(tr("You need to pass a valid mxid when ignoring a user. '%1' is not a valid userid.").arg(user)); + return; + } + UserProfile *profile = new UserProfile(QString(), user, TimelineViewManager::instance()); connect(profile, &UserProfile::failedToFetchProfile, [user, profile] { MainWindow::instance()->showNotification(tr("Failed to fetch user %1").arg(user)); |