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