From 60ea3e046ddc0942677a51c3b6688885d755df8b Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Fri, 17 Sep 2021 14:31:10 -0400 Subject: pv is not defined in case of empty curves - return NaN - as a side effect, do not segfault when epsilon != 0 --- pyisda/credit_index.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 2f90b01..0951f35 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -862,6 +862,8 @@ cdef double pv(const vector[shared_ptr[TCurve]]& curves, size_t i = 0 double* recovery_rate + if curves.size() == 0: + return nan("") if epsilon == 0.: with parallel(): fl_pv = 0. -- cgit v1.2.3-70-g09d2