assert instead of segmentation fault

release/4.3a0
Frank Dellaert 2012-01-22 00:10:04 +00:00
parent b0dea340d2
commit d0d7d1971b
1 changed files with 2 additions and 2 deletions

View File

@ -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(); }