Commit 9b262bbd authored by Guillaume Roguez's avatar Guillaume Roguez Committed by Anthony Léonard

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
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment