From 6f5bda1846ddf33d7b7931a7655068122c773bb1 Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Wed, 1 Feb 2023 11:15:01 +0100 Subject: [PATCH] REST_Geant4_ViewGeometry.C protecting pointers --- macros/REST_Geant4_ViewGeometry.C | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/macros/REST_Geant4_ViewGeometry.C b/macros/REST_Geant4_ViewGeometry.C index 3d96aa6..d6556f4 100644 --- a/macros/REST_Geant4_ViewGeometry.C +++ b/macros/REST_Geant4_ViewGeometry.C @@ -40,6 +40,16 @@ Int_t REST_Geant4_ViewGeometry(TString fName, TString option = "") { cout << "File is not supported!" << endl; } + if (geo == nullptr) { + RESTError << "Geometry initialization failed!" << RESTendl; + return 0; + } + + if (geo->GetMasterVolume() == nullptr) { + RESTError << "No master volume found in the geometry!" << RESTendl; + return 0; + } + if (option == "") { geo->GetMasterVolume()->Draw(); } else if (ToUpper((string)option) == "EVE") {