diff --git a/src/ucioption.cpp b/src/ucioption.cpp index 4761004d..763db556 100644 --- a/src/ucioption.cpp +++ b/src/ucioption.cpp @@ -138,14 +138,14 @@ void UCIOption::operator=(const string& v) { assert(!type.empty()); - if ( (type == "button" || !v.empty()) - && (type != "check" || (v == "true" || v == "false")) - && (type != "spin" || (atoi(v.c_str()) >= min && atoi(v.c_str()) <= max))) - { - if (type != "button") - currentValue = v; + if ( (type != "button" && v.empty()) + || (type == "check" && v != "true" && v != "false") + || (type == "spin" && (atoi(v.c_str()) < min || atoi(v.c_str()) > max))) + return; - if (on_change) - (*on_change)(*this); - } + if (type != "button") + currentValue = v; + + if (on_change) + (*on_change)(*this); }