bed_mesh: disallow null profile names

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-11-04 06:16:41 -04:00 committed by Kevin O'Connor
parent 6be0ba78ae
commit 5e34b45063
1 changed files with 6 additions and 0 deletions

View File

@ -601,6 +601,8 @@ class BedMeshCalibrate:
cmd_BED_MESH_CALIBRATE_help = "Perform Mesh Bed Leveling" cmd_BED_MESH_CALIBRATE_help = "Perform Mesh Bed Leveling"
def cmd_BED_MESH_CALIBRATE(self, gcmd): def cmd_BED_MESH_CALIBRATE(self, gcmd):
self._profile_name = gcmd.get('PROFILE', "default") self._profile_name = gcmd.get('PROFILE', "default")
if not self._profile_name.strip():
raise gcmd.error("Value for parameter 'PROFILE' must be specified")
self.bedmesh.set_mesh(None) self.bedmesh.set_mesh(None)
self.update_config(gcmd) self.update_config(gcmd)
self.probe_helper.start_probe(gcmd) self.probe_helper.start_probe(gcmd)
@ -1229,6 +1231,10 @@ class ProfileManager:
for key in options: for key in options:
name = gcmd.get(key, None) name = gcmd.get(key, None)
if name is not None: if name is not None:
if not name.strip():
raise gcmd.error(
"Value for parameter '%s' must be specified" % (key)
)
if name == "default" and key == 'SAVE': if name == "default" and key == 'SAVE':
gcmd.respond_info( gcmd.respond_info(
"Profile 'default' is reserved, please choose" "Profile 'default' is reserved, please choose"