Fixed is_nil(size_t) when checking out-of-range element

This commit is contained in:
Lukas Matena 2023-01-23 13:23:50 +01:00
parent ae15032e0f
commit 24a91d7420

View file

@ -776,7 +776,7 @@ public:
static int nil_value() { return std::numeric_limits<int>::max(); }
// A scalar is nil, or all values of a vector are nil.
bool is_nil() const override { for (auto v : this->values) if (v != nil_value()) return false; return true; }
bool is_nil(size_t idx) const override { return this->values[idx] == nil_value(); }
bool is_nil(size_t idx) const override { return values[idx < this->values.size() ? idx : 0] == nil_value(); }
std::string serialize() const override
{