From bb72c6c21f505ba48925904ab8c3b9780884b25d Mon Sep 17 00:00:00 2001
From: scott snyder <snyder@bnl.gov>
Date: Fri, 8 Mar 2019 04:23:14 +0100
Subject: [PATCH] GeneratorObjects: Don't trip assertion in eventIndex for a
 null link.

If we have a null link, we can't do the normal eventIndex() processing.
Just return 0 in that case, rather than tripping an assertion.
---
 Generators/GeneratorObjects/src/HepMcParticleLink.cxx | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
index bdf672d83ed..8bbcfddf441 100644
--- a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
+++ b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
@@ -222,6 +222,8 @@ HepMcParticleLink::index_type HepMcParticleLink::eventIndex() const
   index_type index, position;
   m_extBarcode.eventIndex (index, position);
   if (index == ExtendedBarCode::UNDEFINED) {
+    // Don't trip the assertion for a null link.
+    if (barcode() == 0) return 0;
     cptr();
     m_extBarcode.eventIndex (index, position);
     assert (index != ExtendedBarCode::UNDEFINED);
-- 
GitLab