summaryrefslogtreecommitdiff
path: root/src/option.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/option.cpp')
-rw-r--r--src/option.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/option.cpp b/src/option.cpp
index e5a3870..b3fba2f 100644
--- a/src/option.cpp
+++ b/src/option.cpp
@@ -108,6 +108,11 @@ CompOption::Value::Value (CompOption::Type type, const Vector& l) :
set (type, l);
}
+CompOption::Type
+CompOption::Value::type () const
+{
+ return priv->type;
+}
void
CompOption::Value::set (const bool b)
@@ -717,6 +722,15 @@ CompOption::set (CompOption::Value &val)
if (isAction () && priv->type != CompOption::TypeAction)
val.action ().copyState (priv->value.action ());
+ if (priv->type != val.type () &&
+ (!isAction () || !checkIsAction (val.type ())))
+ {
+ compLogMessage ("core", CompLogLevelWarn,
+ "Can't set Value with type %d to option \"%s\" with type %d",
+ val.type (), priv->name.c_str(), priv->type);
+ return false;
+ }
+
if (priv->value == val)
return false;