From 6d25638f24205579690ab4208e2cebdbac0b4d34 Mon Sep 17 00:00:00 2001
From: Pascal Raisig <praisig@ikf.uni-frankfurt.de>
Date: Fri, 19 Jun 2020 10:20:40 +0200
Subject: [PATCH] Trd - nullpointer check with meaningful error msg

---
 core/detectors/trd/CbmTrdParSetGeo.cxx | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/core/detectors/trd/CbmTrdParSetGeo.cxx b/core/detectors/trd/CbmTrdParSetGeo.cxx
index 7fb6e00c7f..043c05a63b 100644
--- a/core/detectors/trd/CbmTrdParSetGeo.cxx
+++ b/core/detectors/trd/CbmTrdParSetGeo.cxx
@@ -34,6 +34,12 @@ Bool_t CbmTrdParSetGeo::Init()
   CbmTrdGeoHandler geo;
   TGeoNode* topNode = gGeoManager->GetTopNode();
   TObjArray* nodes = topNode->GetNodes();
+  if (!nodes)
+  {
+     LOG(error) << "CbmTrdParSetGeo::Init: nodes is null!";
+	 return kFALSE;
+  }
+
   for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
     TGeoNode* node = static_cast<TGeoNode*>(nodes->At(iNode));
     if (!TString(node->GetName()).Contains("trd", TString::kIgnoreCase)) continue; // trd_vXXy top node, e.g. trd_v13a, trd_v14b
-- 
GitLab