Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-11-12 19:03:31 +0000
committerStijn Buys <ingar@osirion.org>2013-11-12 19:03:31 +0000
commitf874c178d9d7744c553ce83a9fde7ab80d110e80 (patch)
tree0128a023f6cb2fd4ce96928c0c6e9737e6f760f2 /src/game
parenta959f46549b562f43a36ec46541bd388958e0174 (diff)
Prevent the 'goto' command from segfaulting on an unknown entity.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/game.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index f41b9b2..4a4441d 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -1564,16 +1564,17 @@ void Game::func_goto(core::Player *player, const std::string &args)
core::Entity *dock = player->control()->zone()->search_entity(args);
- // if target is docked,goto the dock instead
- if (dock->moduletype() == ship_enttype) {
- Ship *ship = static_cast<Ship *>(dock);
-
- if ((ship->state() == core::Entity::Docked) && (ship->dock())) {
- player->send(ship->name() + " docked at " + ship->dock()->name());
- dock = ship->dock();
+ if (dock) {
+ // if target is docked,goto the dock instead
+ if (dock->moduletype() == ship_enttype) {
+ Ship *othership = static_cast<Ship *>(dock);
+
+ if ((othership->state() == core::Entity::Docked) && (othership->dock())) {
+ player->send(othership->name() + " docked at " + othership->dock()->name());
+ dock = othership->dock();
+ }
}
- }
- if (dock) {
+
Ship *ship = static_cast<Ship *>(player->control());
if (dock->type() == core::Entity::Globe) {