Skip to content

Commit

Permalink
Fix accounts avatar issue when it becomes completely white due to non…
Browse files Browse the repository at this point in the history
…-changing account id member with changing account index in the list.

Signed-off-by: allexzander <blackslayer4@gmail.com>
  • Loading branch information
allexzander committed Oct 25, 2022
1 parent 14cb30f commit 319c760
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,15 @@ bool UserModel::isUserConnected(const int id)

QImage UserModel::avatarById(const int id)
{
if (id < 0 || id >= _users.size())
const auto foundUserByIdIter = std::find_if(std::cbegin(_users), std::cend(_users), [&id](const OCC::User* user) {
return user->account()->id() == QString::number(id);
});

if (foundUserByIdIter == std::cend(_users)) {
return {};
}

return _users[id]->avatar();
return (*foundUserByIdIter)->avatar();
}

QString UserModel::currentUserServer()
Expand Down

0 comments on commit 319c760

Please sign in to comment.