mirror of https://github.com/Icinga/icinga2.git
Make sure that Value::IsEmpty() returns true for empty strings
fixes #8018
This commit is contained in:
parent
6fddec0dd3
commit
1ddab493e1
|
@ -51,7 +51,6 @@ class I2_BASE_API Value
|
|||
{
|
||||
public:
|
||||
inline Value(void)
|
||||
: m_Value()
|
||||
{ }
|
||||
|
||||
inline Value(int value)
|
||||
|
@ -91,7 +90,6 @@ public:
|
|||
{ }
|
||||
|
||||
inline Value(Object *value)
|
||||
: m_Value()
|
||||
{
|
||||
if (!value)
|
||||
return;
|
||||
|
@ -101,7 +99,6 @@ public:
|
|||
|
||||
template<typename T>
|
||||
inline Value(const intrusive_ptr<T>& value)
|
||||
: m_Value()
|
||||
{
|
||||
if (!value)
|
||||
return;
|
||||
|
@ -160,7 +157,7 @@ public:
|
|||
*/
|
||||
inline bool IsEmpty(void) const
|
||||
{
|
||||
return (GetType() == ValueEmpty);
|
||||
return (GetType() == ValueEmpty || (IsString() && boost::get<String>(m_Value).IsEmpty()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -163,7 +163,7 @@ void ConfigType::ValidateObject(const Object::Ptr& object,
|
|||
|
||||
Value value = VMOps::GetField(object, require);
|
||||
|
||||
if (value.IsEmpty() || (value.IsString() && static_cast<String>(value).IsEmpty()))
|
||||
if (value.IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Required attribute is missing: " + LocationToString(locations)));
|
||||
|
||||
locations.pop_back();
|
||||
|
|
Loading…
Reference in New Issue