diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index 8fbcc4a..175ea89 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "yaml-cpp/binary.h" #include "yaml-cpp/node/impl.h" @@ -284,12 +285,15 @@ struct convert> { rhs[i] = node[i].as(); #endif } + for (auto i = node.size(); i < N; i++) { + std::memset(&rhs[i], 0, sizeof(T)); + } return true; } private: static bool isNodeValid(const Node& node) { - return node.IsSequence() && node.size() == N; + return node.IsSequence() && node.size() <= N; } };