diff --git a/sparta/sparta/parsers/ConfigEmitterYAML.hpp b/sparta/sparta/parsers/ConfigEmitterYAML.hpp index 1b125ab36b..4734509064 100644 --- a/sparta/sparta/parsers/ConfigEmitterYAML.hpp +++ b/sparta/sparta/parsers/ConfigEmitterYAML.hpp @@ -86,7 +86,6 @@ class YAML : public ConfigEmitter { sparta_assert(emitter_ == nullptr); sparta_assert(device_tree); - sparta_assert(extensions_ptree); if(verbose){ std::cout << "Writing parameters to \"" << filename_ << "\"" << std::endl; @@ -108,22 +107,24 @@ class YAML : public ConfigEmitter handleNode_(device_tree, verbose); - // Note we use the ParameterTree to get the tree node extensions instead - // of the device tree since using the device tree might serialize an extension - // defn of: - // - // top.cpu.core*.extension.core_extensions: - // name: value - // name: value - // - // As: - // - // top.cpu.core0.extension.core_extensions: - // name: value - // name: value - // - // But the ParameterTree retains the wildcards in the path. - handleNode_(extensions_ptree->getRoot()); + if (extensions_ptree) { + // Note we use the ParameterTree to get the tree node extensions instead + // of the device tree since using the device tree might serialize an extension + // defn of: + // + // top.cpu.core*.extension.core_extensions: + // name: value + // name: value + // + // As: + // + // top.cpu.core0.extension.core_extensions: + // name: value + // name: value + // + // But the ParameterTree retains the wildcards in the path. + handleNode_(extensions_ptree->getRoot()); + } *emitter_ << YP::EndDoc; sparta_assert(emitter_->good()); diff --git a/sparta/test/TreeNode/TreeNode_test.cpp b/sparta/test/TreeNode/TreeNode_test.cpp index b7d791a076..4bcd26c32e 100644 --- a/sparta/test/TreeNode/TreeNode_test.cpp +++ b/sparta/test/TreeNode/TreeNode_test.cpp @@ -1103,7 +1103,7 @@ int main() sparta::ConfigEmitter::YAML param_out(filename_orig, true); // verbose - EXPECT_NOTHROW(param_out.addParameters(&top, true)); // verbose + EXPECT_NOTHROW(param_out.addParameters(&top, nullptr, true)); // verbose // Ensure taht the read count on this crazy parameter has not changed // when emitting the YAML @@ -1128,7 +1128,7 @@ int main() // Store Parameter Tree sparta::ConfigEmitter::YAML param_out(filename_new, false); // Terse - EXPECT_NOTHROW(param_out.addParameters(&top, false)); + EXPECT_NOTHROW(param_out.addParameters(&top, nullptr, false)); // Reset read counts to write them again recurs_reset(&top); @@ -1144,7 +1144,7 @@ int main() // Store Parameter Tree sparta::ConfigEmitter::YAML param_out(filename_new, true); // Verbose - EXPECT_NOTHROW(param_out.addParameters(&top, false)); + EXPECT_NOTHROW(param_out.addParameters(&top, nullptr, false)); // Reset read counts to write them again recurs_reset(&top);