From a14a071310c3cc86c7feefa410c5793f0034baeb Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 25 Jan 2011 22:29:16 +0000 Subject: [PATCH] Added check for calling CCOLAMD with zero variables --- gtsam/inference/inference.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gtsam/inference/inference.cpp b/gtsam/inference/inference.cpp index fe4b3044e..d30ea79c4 100644 --- a/gtsam/inference/inference.cpp +++ b/gtsam/inference/inference.cpp @@ -68,9 +68,11 @@ Permutation::shared_ptr Inference::PermutationCOLAMD_(const VariableIndex& varia // call colamd, result will be in p /* returns (1) if successful, (0) otherwise*/ - int rv = ccolamd(nFactors, nVars, Alen, &A[0], &p[0], knobs, stats, &cmember[0]); - if(rv != 1) - throw runtime_error((boost::format("ccolamd failed with return value %1%")%rv).str()); + if(nVars > 0) { + int rv = ccolamd(nFactors, nVars, Alen, &A[0], &p[0], knobs, stats, &cmember[0]); + if(rv != 1) + throw runtime_error((boost::format("ccolamd failed with return value %1%")%rv).str()); + } // ccolamd_report(stats);