From 1515ab0d0077c83a5c3840473161b8e2cda37898 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Tue, 6 Jul 2021 13:47:37 -0500 Subject: [PATCH] Tweak permissions handling in UserListView --- application/views/UserListView.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/application/views/UserListView.cpp b/application/views/UserListView.cpp index d4d52f0..35eee8c 100644 --- a/application/views/UserListView.cpp +++ b/application/views/UserListView.cpp @@ -58,10 +58,8 @@ UserListView::_UserPopUp() return _BlankPopUp(); Role* own_role = fChat->GetRole(fChat->GetOwnId()); - if (own_role == NULL) return _BlankPopUp(); Role* selected_role = fChat->GetRole(selected_user->GetId()); - if (selected_role == NULL) return _BlankPopUp(); Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer(); BObjectList items = server->UserPopUpItems(); @@ -110,10 +108,11 @@ UserListView::_ProcessItem(BMessage* itemMsg, BPopUpMenu* menu, Role* user, toSend.AddInt64("instance", fChat->GetProtocolLooper()->GetInstance()); msg->ReplaceMessage("_msg", &toSend); - if ((perms == 0 || (user->fPerms & perms)) - && (target_perms == 0 || (target->fPerms & target_perms)) - && (target_antiperms == 0 || (!(target->fPerms & target_antiperms))) - && ((priority == false) || (user->fPriority > target->fPriority))) + if ((perms == 0 || ((user != NULL) && (user->fPerms & perms))) + && ((target == NULL) || + ((target_perms == 0 || (target->fPerms & target_perms)) + && (target_antiperms == 0 || (!(target->fPerms & target_antiperms))) + && ((priority == false) || (user->fPriority > target->fPriority))))) { BMenuItem* item = new BMenuItem(msg); if (msg->GetBool("x_to_protocol", true) == true)