From 73b41850ce92552c20557a2fea2f5dca9b73dbc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=28=C2=B4=E3=83=BB=CF=89=E3=83=BB=EF=BD=80=29?= Date: Fri, 23 Feb 2024 00:15:24 +0900 Subject: [PATCH] FIX: Crash when station is destroyed --- gui/line_waiting_status.cc | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/gui/line_waiting_status.cc b/gui/line_waiting_status.cc index e19189c163c..a33c4af0a91 100644 --- a/gui/line_waiting_status.cc +++ b/gui/line_waiting_status.cc @@ -180,24 +180,26 @@ void gui_halt_waiting_catg_t::update() void gui_halt_waiting_catg_t::draw(scr_coord offset) { - // update seed - uint32 temp; - if (catg_index == goods_manager_t::INDEX_PAS) { - temp = halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_PAS)); - } - else if (catg_index == goods_manager_t::INDEX_MAIL) { - temp = halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_MAIL)); - } - else { - // freight - temp = halt->get_finance_history(0, HALT_WAITING) - halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_PAS)) - halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_MAIL)); - } + if (halt.is_bound()) { + // update seed + uint32 temp; + if (catg_index == goods_manager_t::INDEX_PAS) { + temp = halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_PAS)); + } + else if (catg_index == goods_manager_t::INDEX_MAIL) { + temp = halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_MAIL)); + } + else { + // freight + temp = halt->get_finance_history(0, HALT_WAITING) - halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_PAS)) - halt->get_ware_summe(goods_manager_t::get_info(goods_manager_t::INDEX_MAIL)); + } - if(temp!= update_seed) { - update_seed = temp; - update(); + if(temp!= update_seed) { + update_seed = temp; + update(); + } + gui_aligned_container_t::draw(offset); } - gui_aligned_container_t::draw(offset); }