[ox] Fix for GCC pedantry around potential null ptrs that will never happen

This commit is contained in:
Gary Talent 2022-07-13 21:19:02 -05:00
parent db3e9c5d93
commit 94e3ed217a
2 changed files with 6 additions and 2 deletions

View File

@ -365,7 +365,8 @@ constexpr Error MetalClawWriter::field(const char*, const HashMap<String, T> *va
auto wkey = ox_malloca(keyLen + 1, char, 0); auto wkey = ox_malloca(keyLen + 1, char, 0);
memcpy(wkey, key.c_str(), keyLen + 1); memcpy(wkey, key.c_str(), keyLen + 1);
oxReturnError(handler.fieldCString("", wkey.get(), keyLen)); 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; m_buffIt += writer.m_buffIt;
fieldSet = true; fieldSet = true;

View File

@ -122,7 +122,10 @@ class OrganicClawWriter {
ModelHandlerInterface handler{&w}; ModelHandlerInterface handler{&w};
for (std::size_t i = 0; i < keys.size(); ++i) { for (std::size_t i = 0; i < keys.size(); ++i) {
const auto k = keys[i].c_str(); 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; value(key) = w.m_json;
} }