diff --git a/gui/line_waiting_status.cc b/gui/line_waiting_status.cc index 954020dc9df..e5b6084de7b 100644 --- a/gui/line_waiting_status.cc +++ b/gui/line_waiting_status.cc @@ -325,8 +325,9 @@ void gui_line_waiting_status_t::init() } else { // waypoint or depot - depot_t *depot = world()->lookup(i.pos)->get_depot(); - const bool is_waypoint = world()->lookup(i.pos)->get_depot() == NULL; + const grund_t* gr = world()->lookup(i.pos); + depot_t *depot = gr ? gr->get_depot() : nullptr; + const bool is_waypoint = depot == nullptr; if (is_waypoint) { new_component(base_color, line_style, i.pos); } @@ -340,7 +341,7 @@ void gui_line_waiting_status_t::init() if (show_name) { gui_label_buf_t *lb = new_component(SYSCOL_TEXT_WEAK); if (is_waypoint) { - const grund_t* gr = world()->lookup(i.pos); + if (gr) { if (const char *label_text = gr->get_text()) { lb->buf().printf(" %s", label_text);