From e51faff3e3dd4b4510f8da7edea6ddb047eaf044 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 12 Oct 2019 18:10:43 -0700 Subject: [PATCH] Throw an exception if one tries to set a GncOption with an unsupported type. --- libgnucash/app-utils/gnc-option.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libgnucash/app-utils/gnc-option.hpp b/libgnucash/app-utils/gnc-option.hpp index e99c8a2130..68d45d3c6b 100644 --- a/libgnucash/app-utils/gnc-option.hpp +++ b/libgnucash/app-utils/gnc-option.hpp @@ -418,6 +418,11 @@ private: } template void operator()(OptionType& option) const { + std::string msg{"Attempt to set option of type "}; + msg += typeid(OptionType).name(); + msg += " with value of type "; + msg += typeid(m_value).name(); + throw std::invalid_argument(msg); } private: ValueType m_value;