diff --git a/src/ui/newmappopup.cpp b/src/ui/newmappopup.cpp index 697881a4..717d6f1a 100644 --- a/src/ui/newmappopup.cpp +++ b/src/ui/newmappopup.cpp @@ -185,7 +185,9 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() { MapLayout *layout; // If map name is not unique, use default value. Also use only valid characters. + // After stripping invalid characters, strip any leading digits. QString newMapName = this->ui->lineEdit_NewMap_Name->text().remove(QRegularExpression("[^a-zA-Z0-9_]+")); + newMapName = newMapName.remove(QRegularExpression("^[0-9]*")); if (project->mapNames->contains(newMapName) || newMapName.isEmpty()) { newMapName = project->getNewMapName(); }