From d652654e968910a0b024622ff378bbf7949887b7 Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Mon, 4 Apr 2016 22:36:41 +0000
Subject: [PATCH] [BL] Issue error if vector is not parsed fully.

Returns boost::none in the case of error.
---
 BaseLib/ConfigTree-impl.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/BaseLib/ConfigTree-impl.h b/BaseLib/ConfigTree-impl.h
index 6ea8d4a5fac..af8a45023d1 100644
--- a/BaseLib/ConfigTree-impl.h
+++ b/BaseLib/ConfigTree-impl.h
@@ -81,6 +81,17 @@ boost::optional<std::vector<T>> ConfigTree::getConfParamOptionalImpl(
         T value;
         while (sstr >> value)
             result.push_back(value);
+        if (!sstr.eof())  // The stream is not read until the end, must be an
+                        // error. result contains number of read values.
+        {
+            error("Value for key <" + param + "> `" +
+                  shortString(sstr.str()) +
+                  "' not convertible to a vector of the desired type."
+                  " Could not convert token no. " +
+                  std::to_string(result.size() + 1) + ".");
+            return boost::none;
+        }
+
         return boost::make_optional(result);
     }
 
-- 
GitLab