Skip to content

Commit

Permalink
FIX crash in fabrikbauer if no target_cities are found
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@7466 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Dwachs committed Jan 8, 2015
1 parent 936a4c2 commit f9194aa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bauer/fabrikbauer.cc
Expand Up @@ -1008,8 +1008,10 @@ int fabrikbauer_t::increase_industry_density( bool tell_me )
reliefkarte_t::get_karte()->calc_map_size();
// tell the player
if(tell_me) {
stadt_t *s = our_fab->get_target_cities()[0];
const char *stadt_name = s ? s->get_name() : translator::translate("nowhere");
const char *stadt_name = translator::translate("nowhere");
if (!our_fab->get_target_cities().empty()) {
stadt_name = our_fab->get_target_cities()[0]->get_name();
}
cbuffer_t buf;
buf.printf( translator::translate("New factory chain\nfor %s near\n%s built with\n%i factories."), translator::translate(our_fab->get_name()), stadt_name, nr );
welt->get_message()->add_message(buf, pos.get_2d(), message_t::industry, CITY_KI, our_fab->get_besch()->get_haus()->get_tile(0)->get_hintergrund(0, 0, 0));
Expand Down

0 comments on commit f9194aa

Please sign in to comment.