diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 24731567e8f..708860db70e 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -451,16 +451,16 @@ void DesignModeWidget::setCurrentDocument(DesignDocumentController *newDesignDoc this, SLOT(undoAvailable(bool))); disconnect(currentDesignDocumentController(), SIGNAL(redoAvailable(bool)), this, SLOT(redoAvailable(bool))); - disconnect(currentDesignDocumentController(), SIGNAL(deleteAvailable(bool)), - this, SLOT(deleteAvailable(bool))); } m_currentDesignDocumentController = newDesignDocumentController; - connect(currentDesignDocumentController(), SIGNAL(undoAvailable(bool)), + if (currentDesignDocumentController()) { + connect(currentDesignDocumentController(), SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailable(bool))); - connect(currentDesignDocumentController(), SIGNAL(redoAvailable(bool)), + connect(currentDesignDocumentController(), SIGNAL(redoAvailable(bool)), this, SLOT(redoAvailable(bool))); + } if (m_currentDesignDocumentController) {