mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Add more error handling code to logging of enum vals. (addresses #829)
If lookup of enum name by value fails, an error is now sent through the reporter framework and the value logged will be an empty string (as opposed to trying to construct a string with null pointer which throws a logic_error and aborts Bro).
This commit is contained in:
parent
9a86a5e21f
commit
e9c18b51a3
1 changed files with 7 additions and 1 deletions
|
@ -819,7 +819,13 @@ threading::Value* Manager::ValToLogVal(Val* val, BroType* ty)
|
|||
const char* s =
|
||||
val->Type()->AsEnumType()->Lookup(val->InternalInt());
|
||||
|
||||
lval->val.string_val = new string(s);
|
||||
if ( s )
|
||||
lval->val.string_val = new string(s);
|
||||
else
|
||||
{
|
||||
val->Type()->Error("enum type does not contain value", val);
|
||||
lval->val.string_val = new string();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue