FIX: object params variant crash

Change-Id: Ia67b98c29a0cc97f8479911ffdefb942cb6c751f
Jira: none
(cherry picked from commit 8bf65c0963d1ee39bba12f67f33177d4ac6d6a60)
This commit is contained in:
chunmao.guo 2024-12-06 14:05:50 +08:00 committed by Noisyfox
parent 2a35173b8c
commit 660d2ee686
4 changed files with 26 additions and 7 deletions

View file

@ -1015,8 +1015,8 @@ void CheckBox::set_value(const boost::any& value, bool change_event)
m_disable_change_event = !change_event;
if (m_opt.nullable) {
const bool is_value_unsigned_char = value.type() == typeid(unsigned char);
m_is_na_val = is_value_unsigned_char &&
boost::any_cast<unsigned char>(value) == ConfigOptionBoolsNullable::nil_value();
m_is_na_val = value.empty() || (is_value_unsigned_char &&
boost::any_cast<unsigned char>(value) == ConfigOptionBoolsNullable::nil_value());
if (!m_is_na_val)
m_last_meaningful_value = is_value_unsigned_char ? value : static_cast<unsigned char>(boost::any_cast<bool>(value));