forked from qt-creator/qt-creator
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/2958 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com>
This commit is contained in:
@@ -448,8 +448,11 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
|
|||||||
}
|
}
|
||||||
if (m_client->synchronousCheckoutBranch(m_workingDirectory, branch, &errorMessage)) {
|
if (m_client->synchronousCheckoutBranch(m_workingDirectory, branch, &errorMessage)) {
|
||||||
if (errorMessage.isEmpty()) {
|
if (errorMessage.isEmpty()) {
|
||||||
static_cast<BranchNode *>(currentBranch().internalPointer())->current = false;
|
QModelIndex currentIdx = currentBranch();
|
||||||
emit dataChanged(currentBranch(), currentBranch());
|
if (currentIdx.isValid()) {
|
||||||
|
static_cast<BranchNode *>(currentIdx.internalPointer())->current = false;
|
||||||
|
emit dataChanged(currentBranch(), currentBranch());
|
||||||
|
}
|
||||||
static_cast<BranchNode *>(idx.internalPointer())->current = true;
|
static_cast<BranchNode *>(idx.internalPointer())->current = true;
|
||||||
emit dataChanged(idx, idx);
|
emit dataChanged(idx, idx);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user