mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
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:
parent
8e80f97bbc
commit
a531f70890
1 changed files with 5 additions and 0 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue