diff --git a/app/attributes/attributecontroller.cpp b/app/attributes/attributecontroller.cpp index df1d5f38d..084944a5c 100644 --- a/app/attributes/attributecontroller.cpp +++ b/app/attributes/attributecontroller.cpp @@ -1687,6 +1687,13 @@ void AttributeController::renamePhotos() InputUtils::sanitizePath( newName ); + if ( newName.trimmed().isEmpty() ) + { + CoreUtils::log( QStringLiteral( "Photo name format" ), QStringLiteral( "Expression for layer %1, feature %2, field %3 evaluated to an empty or NULL name, keeping the original file name" ).arg( mFeatureLayerPair.layer()->name(), QString::number( mFeatureLayerPair.feature().id() ), field.name() ) ); + ++formItemsIterator; + continue; + } + const QFileInfo fi( src ); newName = QStringLiteral( "%1.%2" ).arg( newName, fi.suffix() );