| Summary: | Crash when exporting geometry with a null material | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | mstoeckl |
| Component: | persistency/gdml | Assignee: | Witold.Pokorski |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | P4 | ||
| Version: | 10.3 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
mstoeckl
2017-06-23 20:52:20 CEST
Hi,
sorry for the delay in handling it.
I have modified G4GDMLWriteStructure to handle the null pointer to material.
Could you please test the diff below?
Cheers,
Witek
Index: src/G4GDMLWriteStructure.cc
===================================================================
--- src/G4GDMLWriteStructure.cc (revision 106330)
+++ src/G4GDMLWriteStructure.cc (working copy)
@@ -448,12 +448,18 @@
const G4String name
= GenerateName(tmplv->GetName(), tmplv);
- const G4String materialref
- = GenerateName(volumePtr->GetMaterial()->GetName(),
- volumePtr->GetMaterial());
+
+ G4String materialref = "NULL";
+
+ if(volumePtr->GetMaterial())
+ {
+ materialref = GenerateName(volumePtr->GetMaterial()->GetName(),
+ volumePtr->GetMaterial());
+ }
+
const G4String solidref
- = GenerateName(solidPtr->GetName(),solidPtr);
-
+ = GenerateName(solidPtr->GetName(),solidPtr);
+
xercesc::DOMElement* volumeElement = NewElement("volume");
volumeElement->setAttributeNode(NewAttribute("name",name));
xercesc::DOMElement* materialrefElement = NewElement("materialref");
|