Don't crash if world is undefined

develop
Quietust 2012-05-23 13:43:41 -05:00
parent 2b862655b7
commit ae41ddc04a
2 changed files with 2 additions and 2 deletions

@ -706,7 +706,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
{ {
static int step_count = 0; static int step_count = 0;
// check run conditions // check run conditions
if(!world->map.block_index || !enable_autolabor) if(!world || !world->map.block_index || !enable_autolabor)
{ {
// give up if we shouldn't be running' // give up if we shouldn't be running'
return CR_OK; return CR_OK;

@ -28,7 +28,7 @@ static int enable_fastdwarf = false;
DFhackCExport command_result plugin_onupdate ( color_ostream &out ) DFhackCExport command_result plugin_onupdate ( color_ostream &out )
{ {
// check run conditions // check run conditions
if(!world->map.block_index || !enable_fastdwarf) if(!world || !world->map.block_index || !enable_fastdwarf)
{ {
// give up if we shouldn't be running' // give up if we shouldn't be running'
return CR_OK; return CR_OK;