mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 20:48:21 +00:00
GH-1487: Handle error from ValueToVal instead of ignoring it
This commit is contained in:
parent
2beaee9318
commit
d6116b0141
1 changed files with 8 additions and 2 deletions
|
@ -557,14 +557,17 @@ Val* Value::ValueToVal(const std::string& source, const Value* val, bool& have_e
|
||||||
}
|
}
|
||||||
|
|
||||||
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
auto s = make_intrusive<SetType>(std::move(set_index), nullptr);
|
||||||
auto* t = new TableVal(std::move(s));
|
auto t = make_intrusive<TableVal>(std::move(s));
|
||||||
for ( int j = 0; j < val->val.set_val.size; j++ )
|
for ( int j = 0; j < val->val.set_val.size; j++ )
|
||||||
{
|
{
|
||||||
Val* assignval = ValueToVal(source, val->val.set_val.vals[j], have_error);
|
Val* assignval = ValueToVal(source, val->val.set_val.vals[j], have_error);
|
||||||
|
if ( have_error )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
t->Assign({AdoptRef{}, assignval}, nullptr);
|
t->Assign({AdoptRef{}, assignval}, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return t.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_VECTOR:
|
case TYPE_VECTOR:
|
||||||
|
@ -589,6 +592,9 @@ Val* Value::ValueToVal(const std::string& source, const Value* val, bool& have_e
|
||||||
for ( int j = 0; j < val->val.vector_val.size; j++ )
|
for ( int j = 0; j < val->val.vector_val.size; j++ )
|
||||||
{
|
{
|
||||||
auto el = ValueToVal(source, val->val.vector_val.vals[j], have_error);
|
auto el = ValueToVal(source, val->val.vector_val.vals[j], have_error);
|
||||||
|
if ( have_error )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
v->Assign(j, {AdoptRef{}, el});
|
v->Assign(j, {AdoptRef{}, el});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue