mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix for looping over vectors with holes per https://github.com/zeek/zeek/issues/1763
This commit is contained in:
parent
87fce26a0b
commit
4c80bd6782
1 changed files with 4 additions and 0 deletions
|
@ -1344,9 +1344,13 @@ ValPtr ForStmt::DoExec(Frame* f, Val* v, StmtFlowType& flow)
|
||||||
else if ( v->GetType()->Tag() == TYPE_VECTOR )
|
else if ( v->GetType()->Tag() == TYPE_VECTOR )
|
||||||
{
|
{
|
||||||
VectorVal* vv = v->AsVectorVal();
|
VectorVal* vv = v->AsVectorVal();
|
||||||
|
const auto& raw_vv = *vv->RawVec();
|
||||||
|
|
||||||
for ( auto i = 0u; i < vv->Size(); ++i )
|
for ( auto i = 0u; i < vv->Size(); ++i )
|
||||||
{
|
{
|
||||||
|
if ( ! raw_vv[i] )
|
||||||
|
continue;
|
||||||
|
|
||||||
// Set the loop variable to the current index, and make
|
// Set the loop variable to the current index, and make
|
||||||
// another pass over the loop body.
|
// another pass over the loop body.
|
||||||
f->SetElement((*loop_vars)[0], val_mgr->Count(i));
|
f->SetElement((*loop_vars)[0], val_mgr->Count(i));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue