Commit bf4ca06c authored by Tobias Hunger's avatar Tobias Hunger

Fix possible crash in git branch dialog

Do not crash when checking out a branch while not currently
on any branch.

Task-number: QTCREATORBUG-5784
Change-Id: I5d007e91c1778e6f09a5d543990d948bc1427599
Reviewed-on: http://codereview.qt.nokia.com/2958Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
parent 5c429665
......@@ -448,8 +448,11 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
}
if (m_client->synchronousCheckoutBranch(m_workingDirectory, branch, &errorMessage)) {
if (errorMessage.isEmpty()) {
static_cast<BranchNode *>(currentBranch().internalPointer())->current = false;
emit dataChanged(currentBranch(), currentBranch());
QModelIndex currentIdx = currentBranch();
if (currentIdx.isValid()) {
static_cast<BranchNode *>(currentIdx.internalPointer())->current = false;
emit dataChanged(currentBranch(), currentBranch());
}
static_cast<BranchNode *>(idx.internalPointer())->current = true;
emit dataChanged(idx, idx);
} else {
......
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