Skip to content

Commit

Permalink
Avoid crash if no project file is selected and OK is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed May 26, 2015
1 parent b91e43a commit 6318f67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -8129,7 +8129,7 @@ void QgisApp::embedLayers()
{
//dialog to select groups/layers from other project files
QgsProjectLayerGroupDialog d( this );
if ( d.exec() == QDialog::Accepted )
if ( d.exec() == QDialog::Accepted && d.isValid() )
{
mMapCanvas->freeze( true );

Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsprojectlayergroupdialog.cpp
Expand Up @@ -102,6 +102,11 @@ QString QgsProjectLayerGroupDialog::selectedProjectFile() const
return mProjectFileLineEdit->text();
}

bool QgsProjectLayerGroupDialog::isValid() const
{
return mTreeView->layerTreeModel() != 0;
}

void QgsProjectLayerGroupDialog::on_mBrowseFileToolButton_clicked()
{
//line edit might emit editingFinished signal when loosing focus
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsprojectlayergroupdialog.h
Expand Up @@ -36,6 +36,8 @@ class APP_EXPORT QgsProjectLayerGroupDialog: public QDialog, private Ui::QgsProj
QStringList selectedLayerNames() const;
QString selectedProjectFile() const;

bool isValid() const;

private slots:
void on_mBrowseFileToolButton_clicked();
void on_mProjectFileLineEdit_editingFinished();
Expand Down

0 comments on commit 6318f67

Please sign in to comment.