From fcc36ccd359be554ec574b9c2ffdd2ced7b5d25f Mon Sep 17 00:00:00 2001
From: Daniel Weindl <daniel.weindl@helmholtz-munich.de>
Date: Tue, 12 Dec 2023 21:56:52 +0100
Subject: [PATCH] ..

---
 python/sdist/amici/de_export.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/python/sdist/amici/de_export.py b/python/sdist/amici/de_export.py
index a4328a610e..f9d553f06c 100644
--- a/python/sdist/amici/de_export.py
+++ b/python/sdist/amici/de_export.py
@@ -2757,11 +2757,12 @@ def _process_heavisides(
         for tmp_old in set(tmp_roots_old):
             # we want unique identifiers for the roots
             tmp_new = self._get_unique_root(tmp_old, roots)
-            heavisides.append((sp.Heaviside(tmp_old), tmp_new))
-
             # `tmp_new` is None if the root is not time-dependent.
             if tmp_new is None:
                 continue
+
+            heavisides.append((sp.Heaviside(tmp_old), tmp_new))
+
             # For Heavisides, we need to add the negative function as well
             self._get_unique_root(sp.sympify(-tmp_old), roots)