mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-29 23:17:46 +00:00
Fix invalid row access in GearListModel
This was based off some previous, bad assumptions in Physis where a row id of 0 was valid. Now we do proper null checks!
This commit is contained in:
parent
a86ef69bdb
commit
928a77aab4
1 changed files with 16 additions and 12 deletions
|
@ -175,21 +175,25 @@ void GearListModel::exdFinished(int index)
|
||||||
auto exd = exdFuture->resultAt(index);
|
auto exd = exdFuture->resultAt(index);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < exh->row_count; i++) {
|
for (unsigned int i = 0; i < exh->row_count; i++) {
|
||||||
const auto row = physis_exd_read_row(&exd, i); // TODO: use all rows, free
|
const auto rows = physis_exd_read_row(&exd, i); // TODO: use all rows, free
|
||||||
|
for (int j = 0; j < rows.row_count; j++) {
|
||||||
|
auto row = rows.row_data[j];
|
||||||
|
if (row.column_data != nullptr) {
|
||||||
|
auto primaryModel = row.column_data[47].u_int64._0;
|
||||||
|
// auto secondaryModel = row.column_data[48].u_int64._0;
|
||||||
|
|
||||||
auto primaryModel = row.row_data[0].column_data[47].u_int64._0;
|
int16_t parts[4];
|
||||||
// auto secondaryModel = row.column_data[48].u_int64._0;
|
memcpy(parts, &primaryModel, sizeof(int16_t) * 4);
|
||||||
|
|
||||||
int16_t parts[4];
|
GearInfo info = {};
|
||||||
memcpy(parts, &primaryModel, sizeof(int16_t) * 4);
|
info.name = row.column_data[9].string._0;
|
||||||
|
info.icon = row.column_data[10].u_int16._0;
|
||||||
|
info.slot = physis_slot_from_id(row.column_data[17].u_int8._0);
|
||||||
|
info.modelInfo.primaryID = parts[0];
|
||||||
|
|
||||||
GearInfo info = {};
|
gears.push_back(info);
|
||||||
info.name = row.row_data[0].column_data[9].string._0;
|
}
|
||||||
info.icon = row.row_data[0].column_data[10].u_int16._0;
|
}
|
||||||
info.slot = physis_slot_from_id(row.row_data[0].column_data[17].u_int8._0);
|
|
||||||
info.modelInfo.primaryID = parts[0];
|
|
||||||
|
|
||||||
gears.push_back(info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue