diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 5fa8adb1..9d3de41e 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -365,7 +365,8 @@ constexpr Error MetalClawWriter::field(const char*, const HashMap *va auto wkey = ox_malloca(keyLen + 1, char, 0); memcpy(wkey, key.c_str(), keyLen + 1); oxReturnError(handler.fieldCString("", wkey.get(), keyLen)); - oxReturnError(handler.field("", val->at(key).value)); + oxRequireM(value, val->at(key)); + oxReturnError(handler.field("", value)); } m_buffIt += writer.m_buffIt; fieldSet = true; diff --git a/deps/ox/src/ox/oc/write.hpp b/deps/ox/src/ox/oc/write.hpp index 182ea4b8..0199b877 100644 --- a/deps/ox/src/ox/oc/write.hpp +++ b/deps/ox/src/ox/oc/write.hpp @@ -122,7 +122,10 @@ class OrganicClawWriter { ModelHandlerInterface handler{&w}; for (std::size_t i = 0; i < keys.size(); ++i) { const auto k = keys[i].c_str(); - oxReturnError(handler.field(k, val->at(k).value)); + if (k) [[likely]] { + oxRequireM(value, val->at(k)); + oxReturnError(handler.field(k, value)); + } } value(key) = w.m_json; }