diff --git a/src/Mod/CAM/Path/Main/Gui/Inspect.py b/src/Mod/CAM/Path/Main/Gui/Inspect.py index 055f18de84..097a81e221 100644 --- a/src/Mod/CAM/Path/Main/Gui/Inspect.py +++ b/src/Mod/CAM/Path/Main/Gui/Inspect.py @@ -260,7 +260,10 @@ class CommandPathInspect: } def IsActive(self): - obj = FreeCADGui.Selection.getSelection()[0] + selection = FreeCADGui.Selection.getSelection() + if len(selection) == 0: + return False + obj = selection[0] return hasattr(obj, "Path") and len(obj.Path.Commands) > 0 def Activated(self): diff --git a/src/Mod/CAM/Path/Main/Gui/SanityCmd.py b/src/Mod/CAM/Path/Main/Gui/SanityCmd.py index b02defb403..32b8f298fe 100644 --- a/src/Mod/CAM/Path/Main/Gui/SanityCmd.py +++ b/src/Mod/CAM/Path/Main/Gui/SanityCmd.py @@ -56,7 +56,10 @@ class CommandCAMSanity: } def IsActive(self): - obj = FreeCADGui.Selection.getSelectionEx()[0].Object + selection = FreeCADGui.Selection.getSelectionEx() + if len(selection) == 0: + return False + obj = selection[0].Object return isinstance(obj.Proxy, Path.Main.Job.ObjectJob) def Activated(self):