Repository: nvaccess/nvda

Issue:
Empty Name field in new configuration profile
if I create a new configuration profiles and leave 
the nave file empty, choose "menuel" and thand try to save this by hitting the "Ok" button...just nothing happens.
I am running NVDA 2020.1 on a Windows 10 system. Disaabeeling the addons and running the repair tool for the com registration didnÄt do any good.


Discussion:
Could you please use the template to submit issues? There are important information from the template that people addressing the issue need to know and that youdid not provide. Here, the "Actual result" and "Expected result" section would be specifically needed.


Resolving patch:
diff --git a/source/config/__init__.py b/source/config/__init__.py
--- a/source/config/__init__.py
+++ b/source/config/__init__.py
@@ -1,7 +1,7 @@
 # -*- coding: UTF-8 -*-
 # A part of NonVisual Desktop Access (NVDA)
 # Copyright (C) 2006-2020 NV Access Limited, Aleksey Sadovoy, Peter Vágner, Rui Batista, Zahari Yurukov,
-# Joseph Lee, Babbage B.V., Łukasz Golonka
+# Joseph Lee, Babbage B.V., Łukasz Golonka, Julien Cochuyt
 # This file is covered by the GNU General Public License.
 # See the file COPYING for more details.
 
@@ -585,6 +585,8 @@ def createProfile(self, name):
 		"""
 		if globalVars.appArgs.secure:
 			return
+		if not name:
+			raise ValueError("Missing name.")
 		fn = self._getProfileFn(name)
 		if os.path.isfile(fn):
 			raise ValueError("A profile with the same name already exists: %s" % name)
@@ -655,6 +657,8 @@ def renameProfile(self, oldName, newName):
 			return
 		if newName == oldName:
 			return
+		if not newName:
+			raise ValueError("Missing newName")
 		oldFn = self._getProfileFn(oldName)
 		newFn = self._getProfileFn(newName)
 		if not os.path.isfile(oldFn):
diff --git a/source/gui/configProfiles.py b/source/gui/configProfiles.py
--- a/source/gui/configProfiles.py
+++ b/source/gui/configProfiles.py
@@ -1,8 +1,7 @@
-#gui/configProfiles.py
-#A part of NonVisual Desktop Access (NVDA)
-#Copyright (C) 2013-2018 NV Access Limited, Joseph Lee
-#This file is covered by the GNU General Public License.
-#See the file COPYING for more details.
+# A part of NonVisual Desktop Access (NVDA)
+# Copyright (C) 2013-2018 NV Access Limited, Joseph Lee, Julien Cochuyt
+# This file is covered by the GNU General Public License.
+# See the file COPYING for more details.
 
 import wx
 import config
@@ -215,13 +214,30 @@ def onProfileListChoice(self, evt):
 	def onRename(self, evt):
 		index = self.profileList.Selection
 		oldName = self.profileNames[index]
-		# Translators: The label of a field to enter a new name for a configuration profile.
-		with wx.TextEntryDialog(self, _("New name:"),
+		while True:
+			with wx.TextEntryDialog(
+				self,
+				# Translators: The label of a field to enter a new name for a configuration profile.
+				_("New name:"),
 				# Translators: The title of the dialog to rename a configuration profile.
-				_("Rename Profile"), value=oldName) as d:
-			if d.ShowModal() == wx.ID_CANCEL:
-				return
-			newName = api.filterFileName(d.Value)
+				caption=_("Rename Profile"),
+				value=oldName
+			) as d:
+				if d.ShowModal() == wx.ID_CANCEL:
+					return
+			newName = d.Value
+			if newName:
+				break
+			gui.messageBox(
+				# Translators: An error displayed when the user attempts to rename a configuration profile
+				# with an empty name.
+				_("A profile cannot have an empty name."),
+				# Translators: The title of an error message dialog.
+				caption=_("Error"),
+				style=wx.ICON_ERROR,
+				parent=self
+			)
+		newName = api.filterFileName(newName)
 		try:
 			config.conf.renameProfile(oldName, newName)
 		except ValueError:
@@ -412,9 +428,20 @@ def onOk(self, evt):
 		) == wx.NO:
 			return
 
-		name = api.filterFileName(self.profileName.Value)
+		name = self.profileName.Value
 		if not name:
+			gui.messageBox(
+				# Translators: An error displayed when the user attempts to create a configuration profile
+				# with an empty name.
+				_("You must choose a name for this profile."),
+				# Translators: The title of an error message dialog.
+				caption=_("Error"),
+				style=wx.ICON_ERROR,
+				parent=self
+			)
+			self.profileName.SetFocus()
 			return
+		name = api.filterFileName(name)
 		try:
 			config.conf.createProfile(name)
 		except ValueError:


Test patch: