[Fix] Fixed seg fault when trying to land in a system with no planets.

This commit is contained in:
Allanis 2013-12-31 06:21:26 +00:00
parent dc3bf1292c
commit 2fc902b90b
2 changed files with 8 additions and 2 deletions

View File

@ -4,8 +4,8 @@
<player> <player>
<ship>TestShip</ship> <ship>TestShip</ship>
<credits> <credits>
<low>10000</low> <low>1000000000000</low>
<high>20000</high> <high>9999999999999999</high>
</credits> </credits>
<date> <date>
<low>1300</low> <low>1300</low>

View File

@ -1689,6 +1689,12 @@ void player_land(void) {
return; return;
} }
/* Check if there are planets to land on. */
if(cur_system->nplanets == 0) {
player_message("There are no planets to land on.");
return;
}
Planet* planet = cur_system->planets[planet_target]; Planet* planet = cur_system->planets[planet_target];
if(planet_target >= 0) { if(planet_target >= 0) {
if(!planet_hasService(planet, PLANET_SERVICE_LAND)) { if(!planet_hasService(planet, PLANET_SERVICE_LAND)) {