[ox/mc] Make write's setTypeInfo return Error if unable to allocate field presence buff

This commit is contained in:
Gary Talent 2023-06-09 20:52:37 -05:00
parent fbfc0afc89
commit b2103e558e

View File

@ -390,9 +390,8 @@ constexpr ox::Error MetalClawWriter<Writer>::setTypeInfo(
int,
const Vector<String>&,
std::size_t fields) noexcept {
// TODO: change all setTypeInfo signatures to return Errors
const auto fieldPresenceLen = (fields - 1) / 8 + 1;
oxIgnoreError(m_writer.write(nullptr, fieldPresenceLen));
oxReturnError(m_writer.write(nullptr, fieldPresenceLen));
m_presenceMapBuff.resize(fieldPresenceLen);
m_fieldPresence.setBuffer(m_presenceMapBuff.data(), m_presenceMapBuff.size());
m_fieldPresence.setFields(static_cast<int>(fields));