From 110860fa4700dabf263918f80afcc75982b7dc37 Mon Sep 17 00:00:00 2001 From: luz paz Date: Sat, 20 Feb 2021 23:02:24 -0500 Subject: [PATCH] Part: Part.CompoundTools.Explode.explodeCompound access a property of... ...a sometimes null object with an error Python code, file `src/Mod/Part/CompoundTools/Explode.py` The `explodeCompound` function can be called in a context without assigning the `ViewObject` property, for example from a command line script. The error that is fixed by this patch. ``` Traceback (most recent call last): ... File "/opt/freecad/Mod/Part/CompoundTools/Explode.py", line 23, in explodeCompound cf.ViewObject.DontUnhideOnDelete = True AttributeError: 'NoneType' object has no attribute 'DontUnhideOnDelete'] ``` Patch submitted by marioamb. Fix #004421 https://tracker.freecadweb.org/view.php?id=4421 --- src/Mod/Part/CompoundTools/Explode.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/CompoundTools/Explode.py b/src/Mod/Part/CompoundTools/Explode.py index f610afea63..11fb6fc25f 100644 --- a/src/Mod/Part/CompoundTools/Explode.py +++ b/src/Mod/Part/CompoundTools/Explode.py @@ -20,7 +20,8 @@ def explodeCompound(compound_obj, b_group = None): cf.Base = compound_obj cf.FilterType = 'specific items' cf.items = str(i) - cf.ViewObject.DontUnhideOnDelete = True + if cf.ViewObject is not None: + cf.ViewObject.DontUnhideOnDelete = True features_created.append(cf) return (group, features_created)