Skip to content

Commit

Permalink
Fix: Crash when no valid airport is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
ldpl committed Jun 30, 2021
1 parent 5ce5b30 commit 68ffdb8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/citymania/cm_highlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,9 +1214,11 @@ HighLightStyle UpdateTileSelection(HighLightStyle new_drawstyle) {
// } else if (((_thd.place_mode & HT_DRAG_MASK) == HT_RECT || ((_thd.place_mode & HT_DRAG_MASK) == HT_SPECIAL && (_thd.next_drawstyle & HT_DRAG_MASK) == HT_RECT)) && _thd.new_outersize.x > 0 && !_thd.make_square_red) { // station
} else if (_thd.select_proc == CM_DDSP_BUILD_AIRPORT) {
auto tile = TileXY(_thd.new_pos.x / TILE_SIZE, _thd.new_pos.y / TILE_SIZE);
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
_thd.cm_new = ObjectHighlight::make_airport(tile, as->GetIndex(), _selected_airport_layout);
new_drawstyle = HT_RECT;
if (_selected_airport_index != -1) {
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
_thd.cm_new = ObjectHighlight::make_airport(tile, as->GetIndex(), _selected_airport_layout);
new_drawstyle = HT_RECT;
}
} else if (_thd.select_proc == DDSP_BUILD_STATION || _thd.select_proc == DDSP_BUILD_BUSSTOP
|| _thd.select_proc == DDSP_BUILD_TRUCKSTOP) { // station
if (_thd.size.x >= (int)TILE_SIZE && _thd.size.y >= (int)TILE_SIZE) {
Expand Down

0 comments on commit 68ffdb8

Please sign in to comment.