Skip to content

Commit

Permalink
Prevent sailing towards null hex
Browse files Browse the repository at this point in the history
  • Loading branch information
artyomtrityak committed Oct 2, 2019
1 parent c2da970 commit a4b0afb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,8 @@ int Object::SailThroughCheck(int dir)

// fleet is not flying and it is in a land region. Check that it
// doesn's sail inland
if (TerrainDefs[region->neighbors[dir]->type].similar_type != R_OCEAN) {
// sailing inland
if (!region->neighbors[dir] || TerrainDefs[region->neighbors[dir]->type].similar_type != R_OCEAN) {
// sailing inland or towards null hex
return 0;
}

Expand Down

0 comments on commit a4b0afb

Please sign in to comment.