Skip to content

Commit 6318f67

Browse files
committedMay 26, 2015
Avoid crash if no project file is selected and OK is clicked
1 parent b91e43a commit 6318f67

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8129,7 +8129,7 @@ void QgisApp::embedLayers()
81298129
{
81308130
//dialog to select groups/layers from other project files
81318131
QgsProjectLayerGroupDialog d( this );
8132-
if ( d.exec() == QDialog::Accepted )
8132+
if ( d.exec() == QDialog::Accepted && d.isValid() )
81338133
{
81348134
mMapCanvas->freeze( true );
81358135

‎src/app/qgsprojectlayergroupdialog.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ QString QgsProjectLayerGroupDialog::selectedProjectFile() const
102102
return mProjectFileLineEdit->text();
103103
}
104104

105+
bool QgsProjectLayerGroupDialog::isValid() const
106+
{
107+
return mTreeView->layerTreeModel() != 0;
108+
}
109+
105110
void QgsProjectLayerGroupDialog::on_mBrowseFileToolButton_clicked()
106111
{
107112
//line edit might emit editingFinished signal when loosing focus

‎src/app/qgsprojectlayergroupdialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class APP_EXPORT QgsProjectLayerGroupDialog: public QDialog, private Ui::QgsProj
3636
QStringList selectedLayerNames() const;
3737
QString selectedProjectFile() const;
3838

39+
bool isValid() const;
40+
3941
private slots:
4042
void on_mBrowseFileToolButton_clicked();
4143
void on_mProjectFileLineEdit_editingFinished();

0 commit comments

Comments
 (0)
Please sign in to comment.