Skip to content
Permalink
Browse files
Avoid crash if no project file is selected and OK is clicked
(cherry picked from commit 6318f67)
  • Loading branch information
wonder-sk authored and jef-n committed May 27, 2015
1 parent 3dd8008 commit 3c701509164f274eba7feee2baccc3d1972b3a58
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
@@ -8032,7 +8032,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 3c70150

Please sign in to comment.