[Fix] Segfault when trying to land on a system with no planets.
This commit is contained in:
parent
fee98162a6
commit
a6805df42d
@ -79,7 +79,8 @@ void gl_bindCamera(const Vec2* pos);
|
||||
// Circle drawing.
|
||||
void gl_drawCircle(const double x, const double y, const double r);
|
||||
void gl_drawCircleInRect(const double x, const double y, const double r,
|
||||
const double rc, const double ry, const double rw, const double rh);
|
||||
const double rc, const double ry, const double rw,
|
||||
const double rh);
|
||||
|
||||
// Initialize/cleanup.
|
||||
int gl_init(void);
|
||||
|
11
src/player.c
11
src/player.c
@ -1178,6 +1178,10 @@ void player_targetPlanet(void) {
|
||||
|
||||
// Attempt to land or target closest planet if no land target.
|
||||
void player_land(void) {
|
||||
int i;
|
||||
int tp;
|
||||
double td, d;
|
||||
|
||||
if(landed) {
|
||||
// Player is already landed.
|
||||
takeoff();
|
||||
@ -1211,9 +1215,10 @@ void player_land(void) {
|
||||
land(planet); // Land the player.
|
||||
} else {
|
||||
// Get nearest planet target.
|
||||
int i;
|
||||
int tp;
|
||||
double td, d;
|
||||
if(cur_system->nplanets == 0) {
|
||||
player_message("There are no planets to land on.");
|
||||
return;
|
||||
}
|
||||
|
||||
td = -1; // Temp distance.
|
||||
tp = -1; // Temp planet.
|
||||
|
Loading…
Reference in New Issue
Block a user