mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-31 01:24:19 +02:00
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:
|
public:
|
||||||
inline Value(void)
|
inline Value(void)
|
||||||
: m_Value()
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
inline Value(int value)
|
inline Value(int value)
|
||||||
@ -91,7 +90,6 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
inline Value(Object *value)
|
inline Value(Object *value)
|
||||||
: m_Value()
|
|
||||||
{
|
{
|
||||||
if (!value)
|
if (!value)
|
||||||
return;
|
return;
|
||||||
@ -101,7 +99,6 @@ public:
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline Value(const intrusive_ptr<T>& value)
|
inline Value(const intrusive_ptr<T>& value)
|
||||||
: m_Value()
|
|
||||||
{
|
{
|
||||||
if (!value)
|
if (!value)
|
||||||
return;
|
return;
|
||||||
@ -160,7 +157,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline bool IsEmpty(void) const
|
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);
|
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)));
|
BOOST_THROW_EXCEPTION(ScriptError("Required attribute is missing: " + LocationToString(locations)));
|
||||||
|
|
||||||
locations.pop_back();
|
locations.pop_back();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user