mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
GH-1555: Fix reading empty set[enum] values from config files
This commit is contained in:
parent
09ff24199b
commit
e35888a994
3 changed files with 12 additions and 2 deletions
|
@ -519,7 +519,8 @@ Val* Value::ValueToVal(const std::string& source, const Value* val, bool& have_e
|
|||
case TYPE_TABLE:
|
||||
{
|
||||
TypeListPtr set_index;
|
||||
if ( val->val.set_val.size == 0 && val->subtype == TYPE_VOID )
|
||||
if ( val->val.set_val.size == 0 &&
|
||||
( val->subtype == TYPE_VOID || val->subtype == TYPE_ENUM ) )
|
||||
// don't know type - unspecified table.
|
||||
set_index = make_intrusive<TypeList>();
|
||||
else
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
Red,
|
||||
Green
|
||||
}
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
@TEST-START-FILE configfile
|
||||
mycolors Red,asdf,Blue
|
||||
nocolors
|
||||
@TEST-END-FILE
|
||||
|
||||
@load base/frameworks/config
|
||||
|
@ -12,9 +13,14 @@ mycolors Red,asdf,Blue
|
|||
type Color: enum { Red, Green, Blue, };
|
||||
|
||||
option mycolors = set(Red, Green);
|
||||
option nocolors = set(Red, Green);
|
||||
|
||||
event zeek_init()
|
||||
{ Config::read_config("../configfile"); }
|
||||
|
||||
event Input::end_of_data(name: string, source:string)
|
||||
{ print mycolors; terminate(); }
|
||||
{
|
||||
print mycolors;
|
||||
print nocolors;
|
||||
terminate();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue