From e50d22f0134d80234d101590cfc5ad251a9baa70 Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Wed, 6 Apr 2022 16:02:55 +0000 Subject: [PATCH] fix(userspace/engine): solve integration test errors Signed-off-by: Jason Dellaluce --- userspace/engine/rule_loader.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/userspace/engine/rule_loader.cpp b/userspace/engine/rule_loader.cpp index e6c288f6..29c86396 100644 --- a/userspace/engine/rule_loader.cpp +++ b/userspace/engine/rule_loader.cpp @@ -587,19 +587,22 @@ bool rule_loader::read(const string &content, falco_engine* engine, } for(auto it = doc->begin(); it != doc->end(); it++) { - string ctx = yaml_format_object(content, docs, doc, it); - YAML::Node item = *it; - try + if (!it->IsNull()) { - THROW(!item.IsMap(), "Unexpected element type. " - "Each element should be a yaml associative array."); - item["context"] = ctx; - read_item(engine, item, warnings); - } - catch(const exception& e) - { - errors.push_back(ctxerr(ctx, e.what())); - return false; + string ctx = yaml_format_object(content, docs, doc, it); + YAML::Node item = *it; + try + { + THROW(!item.IsMap(), "Unexpected element type. " + "Each element should be a yaml associative array."); + item["context"] = ctx; + read_item(engine, item, warnings); + } + catch(const exception& e) + { + errors.push_back(ctxerr(ctx, e.what())); + return false; + } } } }