Skip to content

Commit

Permalink
Part: Part.CompoundTools.Explode.explodeCompound access a property of...
Browse files Browse the repository at this point in the history
...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 #4421  
https://tracker.freecadweb.org/view.php?id=4421
  • Loading branch information
luzpaz authored and wwmayer committed Feb 21, 2021
1 parent 9fb381b commit 110860f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Mod/Part/CompoundTools/Explode.py
Expand Up @@ -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)

0 comments on commit 110860f

Please sign in to comment.