Skip to content
Permalink
Browse files
Avoid crash if no project file is selected and OK is clicked
  • Loading branch information
wonder-sk committed May 26, 2015
1 parent b91e43a commit 6318f67bfc62d9c124eae620aecb4987d758582b
Showing with 8 additions and 1 deletion.
  1. +1 −1 src/app/qgisapp.cpp
  2. +5 −0 src/app/qgsprojectlayergroupdialog.cpp
  3. +2 −0 src/app/qgsprojectlayergroupdialog.h
@@ -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 );

@@ -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
@@ -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();

0 comments on commit 6318f67

Please sign in to comment.