Skip to content
Snippets Groups Projects
Commit 9b262bbd authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Anthony Léonard
Browse files

account: fix empty vector access


NewAccountModelPimpl::slotProfileUpdated() does an access on first
element on a vector without checking if it's not empty.
This results in immediate crash.
Fixed by checking the empty condition and doing nothing in such case.

Change-Id: I49276e7ddc7034ebac24d1c109313751f06b4746
Tuleap: #1779
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent a4dfd6c8
No related branches found
No related tags found
No related merge requests found
......@@ -206,7 +206,9 @@ NewAccountModelPimpl::slotAccountRemoved(Account* account)
void
NewAccountModelPimpl::slotProfileUpdated(const Profile* profile)
{
emit linked.profileUpdated(profile->accounts().first()->id().toStdString());
auto& accounts = profile->accounts();
if (!accounts.empty())
emit linked.profileUpdated(accounts.first()->id().toStdString());
}
} // namespace lrc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment