Skip to content

Commit

Permalink
Display an error when an auxiliary layer cannot be created
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Jun 7, 2021
1 parent d290df2 commit eb7d465
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/gui/qgsnewauxiliarylayerdialog.cpp
Expand Up @@ -46,13 +46,18 @@ void QgsNewAuxiliaryLayerDialog::accept()

if ( idx >= 0 )
{
QString errorMsg;
const QgsField field = mLayer->fields().field( idx );
QgsAuxiliaryLayer *alayer = QgsProject::instance()->auxiliaryStorage()->createAuxiliaryLayer( field, mLayer );
QgsAuxiliaryLayer *alayer = QgsProject::instance()->auxiliaryStorage()->createAuxiliaryLayer( field, mLayer, &errorMsg );

if ( alayer )
{
mLayer->setAuxiliaryLayer( alayer );
}
else
{
QMessageBox::critical( this, tr( "New Auxiliary Layer" ), errorMsg );
}
}

QDialog::accept();
Expand Down

0 comments on commit eb7d465

Please sign in to comment.