Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix: Fix crash on accept or reject friend request
Browse files Browse the repository at this point in the history
Fix #4603
  • Loading branch information
Diadlo committed Aug 28, 2017
1 parent 22732b6 commit 359a42f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/widget/form/addfriendform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ void AddFriendForm::onFriendRequestAccepted()
QPushButton* acceptButton = static_cast<QPushButton*>(sender());
QWidget* friendWidget = acceptButton->parentWidget();
const int index = requestsLayout->indexOf(friendWidget);
const int indexFromEnd = requestsLayout->count() - index - 1;
removeFriendRequestWidget(friendWidget);
const int indexFromEnd = requestsLayout->count() - index - 1;
const Settings::Request request = Settings::getInstance().getFriendRequest(indexFromEnd);
emit friendRequestAccepted(ToxId(request.address).getPublicKey());
Settings::getInstance().removeFriendRequest(indexFromEnd);
Expand All @@ -327,8 +327,8 @@ void AddFriendForm::onFriendRequestRejected()
QPushButton* rejectButton = static_cast<QPushButton*>(sender());
QWidget* friendWidget = rejectButton->parentWidget();
const int index = requestsLayout->indexOf(friendWidget);
const int indexFromEnd = requestsLayout->count() - index - 1;
removeFriendRequestWidget(friendWidget);
const int indexFromEnd = requestsLayout->count() - index - 1;
Settings::getInstance().removeFriendRequest(indexFromEnd);
Settings::getInstance().savePersonal();
}
Expand Down

0 comments on commit 359a42f

Please sign in to comment.