mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
fix for cloning records with fields of type "any"
This commit is contained in:
parent
cd8e16e090
commit
099dc99d2b
2 changed files with 8 additions and 5 deletions
|
@ -1176,13 +1176,15 @@ public:
|
|||
/**
|
||||
* Appends a value to the record's fields. The caller is responsible
|
||||
* for ensuring that fields are appended in the correct order and
|
||||
* with the correct type.
|
||||
* with the correct type. The type needs to be passed in because
|
||||
* it's unsafe to take it from v when the field's type is "any" while
|
||||
* v is a concrete type.
|
||||
* @param v The value to append.
|
||||
*/
|
||||
void AppendField(ValPtr v)
|
||||
void AppendField(ValPtr v, const TypePtr& t)
|
||||
{
|
||||
if ( v )
|
||||
record_val->emplace_back(ZVal(v, v->GetType()));
|
||||
record_val->emplace_back(ZVal(v, t));
|
||||
else
|
||||
record_val->emplace_back(std::nullopt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue