View Issue Details

IDProjectCategoryView StatusLast Update
0004421FreeCADPatchpublic2021-02-21 11:29
Reportermarioamb Assigned ToKunda1  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
Target Version0.19Fixed in Version0.19 
Summary0004421: Part.CompoundTools.Explode.explodeCompound access a property of a sometimes null object with an error
DescriptionPython 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:
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']

I attach the simple patch to the code to correct it.
TagsNo tags attached.
FreeCAD InformationOS: Debian GNU/Linux bullseye/sid (MATE/mate)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21619 (Git)
Build type: Release
Branch: master
Hash: 58e459cde1a60365510f308d94405ce58c9b008d
Python version: 3.8.5
Qt version: 5.14.2
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)

Activities

marioamb

2020-08-20 08:20

reporter  

Explode.patch (500 bytes)   
--- ./src/Mod/Part/CompoundTools/Explode.py.orig	2020-08-20 09:56:20.501325332 +0200
+++ ./src/Mod/Part/CompoundTools/Explode.py	2020-08-20 09:56:55.732717600 +0200
@@ -20,6 +20,7 @@
         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)
Explode.patch (500 bytes)   

Kunda1

2021-02-21 04:05

administrator   ~0015406

Submitted FreeCAD Pull Request 4501

guest

2021-02-21 11:00

viewer   ~0015409

Fix committed to master branch.

Kunda1

2021-02-21 11:29

administrator   ~0015410

Thanks @marioamb
Sorry we missed this patch, it some how slipped through the cracks. Next time please open a forum thread first per our guidelines. Thanks again.

Related Changesets

FreeCAD: master 110860fa

2021-02-21 04:02:24

luz paz


Committer: wwmayer Details Diff
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 0004421
https://tracker.freecadweb.org/view.php?id=4421
Affected Issues
0004421
mod - src/Mod/Part/CompoundTools/Explode.py Diff File

Issue History

Date Modified Username Field Change
2020-08-20 08:20 marioamb New Issue
2020-08-20 08:20 marioamb File Added: Explode.patch
2021-02-06 06:49 abdullah Target Version => 0.20
2021-02-21 03:54 Kunda1 Description Updated
2021-02-21 03:54 Kunda1 FreeCAD Information OS: Debian GNU/Linux bullseye/sid (MATE/mate) Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.21619 (Git) Build type: Release Branch: master Hash: 58e459cde1a60365510f308d94405ce58c9b008d Python version: 3.8.5 Qt version: 5.14.2 Coin... => OS: Debian GNU/Linux bullseye/sid (MATE/mate) Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19.21619 (Git) Build type: Release Branch: master Hash: 58e459cde1a60365510f308d94405ce58c9b008d Python version: 3.8.5 Qt version: 5.1...
2021-02-21 03:59 Kunda1 Category Bug => Patch
2021-02-21 03:59 Kunda1 Target Version 0.20 => 0.19
2021-02-21 04:05 Kunda1 Note Added: 0015406
2021-02-21 04:08 Kunda1 Assigned To => Kunda1
2021-02-21 04:08 Kunda1 Status new => assigned
2021-02-21 11:00 Changeset attached => FreeCAD master 110860fa
2021-02-21 11:00 guest Note Added: 0015409
2021-02-21 11:29 Kunda1 Status assigned => closed
2021-02-21 11:29 Kunda1 Resolution open => fixed
2021-02-21 11:29 Kunda1 Fixed in Version => 0.19
2021-02-21 11:29 Kunda1 Note Added: 0015410