fix(dbc): skip non-array rows in loadJSON instead of failing

A JSON DBC with a malformed record (object instead of array, or
a string entry) would call row[col] which throws on non-arrays —
the outer try-catch treated this as a hard failure for the whole
DBC. Skip the row (stays zero-initialized) so a single malformed
record doesn't lose all the rest.
This commit is contained in:
Kelsi 2026-05-06 10:07:49 -07:00
parent 8e80f97bbc
commit a531f70890

View file

@ -441,6 +441,11 @@ bool DBCFile::loadJSON(const std::vector<uint8_t>& jsonData) {
for (uint32_t i = 0; i < recordCount; i++) {
const auto& row = records[i];
// Skip non-array rows (object, string, etc.) — row[col] throws
// on a non-array, which the outer try-catch would treat as a
// hard load failure for the whole file. Empty record stays
// zero-initialized from the resize() above.
if (!row.is_array()) continue;
uint32_t* fields = reinterpret_cast<uint32_t*>(
recordData.data() + static_cast<size_t>(i) * recordSize);