summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-12-22 00:05:45 +1100
committer Vas Crabb <vas@vastheman.com>2022-12-22 00:05:45 +1100
commit243cc15a804aa45e5060ca6f9198ce228d61014f (patch)
tree13ce3b6052661b457cceed6a6fb1fef71f14ebab /src/lib
parentb17cd1e0605892afecf8c2dd63557e544ecbd169 (diff)
util/options.cpp: Fixed issue when copying options that don't carry values.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/options.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp
index 890a48f0727..f08e97b7985 100644
--- a/src/lib/util/options.cpp
+++ b/src/lib/util/options.cpp
@@ -425,12 +425,12 @@ const char *core_options::simple_entry::value() const noexcept
{
switch (type())
{
- case core_options::option_type::BOOLEAN:
- case core_options::option_type::INTEGER:
- case core_options::option_type::FLOAT:
- case core_options::option_type::STRING:
- case core_options::option_type::PATH:
- case core_options::option_type::MULTIPATH:
+ case option_type::BOOLEAN:
+ case option_type::INTEGER:
+ case option_type::FLOAT:
+ case option_type::STRING:
+ case option_type::PATH:
+ case option_type::MULTIPATH:
return m_data.c_str();
default:
@@ -502,12 +502,24 @@ bool core_options::simple_entry::internal_copy_value(const entry &that)
}
else
{
- validate(simple->m_data);
+ switch (simple->type())
+ {
+ case option_type::BOOLEAN:
+ case option_type::INTEGER:
+ case option_type::FLOAT:
+ case option_type::STRING:
+ case option_type::PATH:
+ case option_type::MULTIPATH:
+ validate(simple->m_data);
- m_data = simple->m_data;
- m_data_unsubst = simple->m_data_unsubst;
+ m_data = simple->m_data;
+ m_data_unsubst = simple->m_data_unsubst;
- return true;
+ return true;
+
+ default:
+ return false;
+ }
}
}