From d0d7d1971b1f16015e2bd615d0587c0b21674835 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 22 Jan 2012 00:10:04 +0000 Subject: [PATCH] assert instead of segmentation fault --- gtsam/inference/Conditional.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtsam/inference/Conditional.h b/gtsam/inference/Conditional.h index d75070635..1d6d07303 100644 --- a/gtsam/inference/Conditional.h +++ b/gtsam/inference/Conditional.h @@ -126,8 +126,8 @@ public: size_t nrParents() const { return FactorType::size() - nrFrontals_; } /** Special accessor when there is only one frontal variable. */ - Key firstFrontalKey() const { return FactorType::front(); } - Key lastFrontalKey() const { return *(endFrontals()-1); } + Key firstFrontalKey() const { assert(nrFrontals_>0); return FactorType::front(); } + Key lastFrontalKey() const { assert(nrFrontals_>0); return *(endFrontals()-1); } /** Iterators over frontal and parent variables. */ const_iterator beginFrontals() const { return FactorType::begin(); }