From 1b697b197152ae0f17c7fc9ae1e57cf5544e3b0a Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 23 Dec 2019 07:45:19 +0100 Subject: [PATCH] fix Key as size_t (Closes #182) --- gtsam/linear/IterativeSolver.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtsam/linear/IterativeSolver.cpp b/gtsam/linear/IterativeSolver.cpp index c7d4e5405..c5007206d 100644 --- a/gtsam/linear/IterativeSolver.cpp +++ b/gtsam/linear/IterativeSolver.cpp @@ -115,8 +115,11 @@ void KeyInfo::initialize(const GaussianFactorGraph &fg) { size_t start = 0; for (size_t i = 0; i < n; ++i) { - const size_t key = ordering_[i]; - const size_t dim = colspec.find(key)->second; + const Key key = ordering_[i]; + const auto it_key = colspec.find(key); + if (it_key==colspec.end()) + throw std::runtime_error("KeyInfo: Inconsistency in key-dim map"); + const size_t dim = it_key->second; this->emplace(key, KeyInfoEntry(i, dim, start)); start += dim; }