From db7e831a2bc3c3efab92df0db4af77211cdc8b15 Mon Sep 17 00:00:00 2001
From: Andreas Gattringer <gattringera@a772-cvl-ws23.biodiv.univie.ac.at>
Date: Thu, 23 Feb 2023 14:09:12 +0100
Subject: [PATCH] extra sanity check for habitat types

---
 src/cats/overlays/overlay_habitat_type_cc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/cats/overlays/overlay_habitat_type_cc.c b/src/cats/overlays/overlay_habitat_type_cc.c
index a349ef0..e98c258 100644
--- a/src/cats/overlays/overlay_habitat_type_cc.c
+++ b/src/cats/overlays/overlay_habitat_type_cc.c
@@ -107,8 +107,9 @@ double get_habitat_cc_multiplier(const struct habitat_layer_cc_aux *aux, int32_t
                             aux->max_code);
                 exit(EXIT_FAILURE);
         }
-
-        return aux->habitat_multipliers[habitat_type];
+        double result = aux->habitat_multipliers[habitat_type];
+        assert(result >= 0.0);
+        return result;
 }
 
 
-- 
GitLab