Skip to content

Guard against null GetVisAttributes() in G4Ttree_item constructor#147

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/137-visattr-null-guard
Jun 13, 2026
Merged

Guard against null GetVisAttributes() in G4Ttree_item constructor#147
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/137-visattr-null-guard

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

G4LogicalVolume::GetVisAttributes() returns nullptr for volumes with no vis attributes (e.g. imported CAD/GDML geometries), and the G4Ttree_item constructor dereferenced it unconditionally for both GetColour() and IsVisible(), crashing the geometry tree viewer (it builds one item per volume). This adds a null check with an opaque-white, visible fallback.

Validation: translation unit recompiled cleanly with Geant4 11.4.1 / ROOT 6.38 / Qt 6.9 (ghcr.io/gemc/src:dev-almalinux-10).

Fixes #137

G4LogicalVolume::GetVisAttributes() returns nullptr for volumes with no
vis attributes (e.g. imported CAD/GDML geometries), and the constructor
dereferenced it unconditionally, crashing the geometry tree viewer. Add
a null check with an opaque-white, visible fallback.

Fixes gemc#137

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit af79a28 into gemc:main Jun 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Low] Guard against null GetVisAttributes() in G4Ttree_item constructor

2 participants