@@ -51,30 +51,31 @@ MapListWidget::MapListWidget(GameData *data, QWidget *parent)
51
51
const uint16_t territoryTypeKey = rows.row_data [0 ].column_data [15 ].u_int16 ._0 ;
52
52
if (territoryTypeKey > 0 && territoryTypeKey < territoryExh->row_count ) {
53
53
auto territoryExdRow = physis_exd_read_row (&territoryExd, territoryTypeKey); // TODO: free, use all rows
54
-
55
- const char *bg = territoryExdRow.row_data [0 ].column_data [1 ].string ._0 ;
56
-
57
- int placeRegionKey = territoryExdRow.row_data [0 ].column_data [3 ].u_int16 ._0 ;
58
- auto regionExdRow = physis_exd_read_row (&nameExd, placeRegionKey); // TODO: free, use all rows
59
- const char *placeRegion = regionExdRow.row_data [0 ].column_data [0 ].string ._0 ;
60
-
61
- int placeZoneKey = territoryExdRow.row_data [0 ].column_data [4 ].u_int16 ._0 ;
62
- auto zoneExdRow = physis_exd_read_row (&nameExd, placeRegionKey); // TODO: free, use all rows
63
- const char *placeZone = zoneExdRow.row_data [0 ].column_data [0 ].string ._0 ;
64
-
65
- int placeNameKey = territoryExdRow.row_data [0 ].column_data [5 ].u_int16 ._0 ;
66
- auto nameExdRow = physis_exd_read_row (&nameExd, placeRegionKey); // TODO: free, use all rows
67
- const char *placeName = nameExdRow.row_data [0 ].column_data [0 ].string ._0 ;
68
-
69
- QStandardItem *item = new QStandardItem ();
70
- item->setData (QString::fromStdString (bg));
71
- item->setText (QStringLiteral (" %1 (%2, %3, %4)" )
72
- .arg (QString::fromStdString (id),
73
- QString::fromStdString (placeRegion),
74
- QString::fromStdString (placeZone),
75
- QString::fromStdString (placeName)));
76
-
77
- originalModel->insertRow (originalModel->rowCount (), item);
54
+ if (territoryExdRow.row_count != 0 ) {
55
+ const char *bg = territoryExdRow.row_data [0 ].column_data [1 ].string ._0 ;
56
+
57
+ int placeRegionKey = territoryExdRow.row_data [0 ].column_data [3 ].u_int16 ._0 ;
58
+ auto regionExdRow = physis_exd_read_row (&nameExd, placeRegionKey); // TODO: free, use all rows
59
+ const char *placeRegion = regionExdRow.row_data [0 ].column_data [0 ].string ._0 ;
60
+
61
+ int placeZoneKey = territoryExdRow.row_data [0 ].column_data [4 ].u_int16 ._0 ;
62
+ auto zoneExdRow = physis_exd_read_row (&nameExd, placeRegionKey); // TODO: free, use all rows
63
+ const char *placeZone = zoneExdRow.row_data [0 ].column_data [0 ].string ._0 ;
64
+
65
+ int placeNameKey = territoryExdRow.row_data [0 ].column_data [5 ].u_int16 ._0 ;
66
+ auto nameExdRow = physis_exd_read_row (&nameExd, placeRegionKey); // TODO: free, use all rows
67
+ const char *placeName = nameExdRow.row_data [0 ].column_data [0 ].string ._0 ;
68
+
69
+ QStandardItem *item = new QStandardItem ();
70
+ item->setData (QString::fromStdString (bg));
71
+ item->setText (QStringLiteral (" %1 (%2, %3, %4)" )
72
+ .arg (QString::fromStdString (id),
73
+ QString::fromStdString (placeRegion),
74
+ QString::fromStdString (placeZone),
75
+ QString::fromStdString (placeName)));
76
+
77
+ originalModel->insertRow (originalModel->rowCount (), item);
78
+ }
78
79
}
79
80
}
80
81
0 commit comments