From cca5aca07819e6d8f81808625bfab0879919552b Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Fri, 10 Feb 2017 10:25:45 +0100
Subject: [PATCH] DDRec: LayeringExtension prevent use of invalid iterator

---
 DDRec/src/LayeringExtensionImpl.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/DDRec/src/LayeringExtensionImpl.cpp b/DDRec/src/LayeringExtensionImpl.cpp
index e2cef63fb..e251b55b4 100644
--- a/DDRec/src/LayeringExtensionImpl.cpp
+++ b/DDRec/src/LayeringExtensionImpl.cpp
@@ -171,7 +171,9 @@ void LayeringExtensionImpl::checkMap(int layerIndex) const {
 	map<int, LayerAttributes>::iterator it;
 	it = _layerMap.find(layerIndex);
 	if (it == _layerMap.end()) {
-		// TODO throw exception
+	  std::stringstream err;
+	  err << "No entry found for layer" << layerIndex;
+	  throw std::out_of_range(err.str());
 	}
 	if (not it->second.isCalculated) {
 		it->second.calculate();
-- 
GitLab