From a799fc437ddfd02e29a887b42c8f4c8fc2821b00 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Fri, 29 Mar 2019 19:24:00 +0500 Subject: [PATCH] Don't crash if no loading tips found --- src/xrGame/GamePersistent.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/xrGame/GamePersistent.cpp b/src/xrGame/GamePersistent.cpp index aa892afb609..2a73bcffc45 100644 --- a/src/xrGame/GamePersistent.cpp +++ b/src/xrGame/GamePersistent.cpp @@ -880,21 +880,28 @@ void CGamePersistent::LoadTitle(bool change_tip, shared_str map_name) pApp->LoadStage(); if (change_tip) { + bool noTips = false; string512 buff; u8 tip_num; luabind::functor m_functor; - bool is_single = !xr_strcmp(m_game_params.m_game_type, "single"); + const bool is_single = !xr_strcmp(m_game_params.m_game_type, "single"); if (is_single) { - R_ASSERT(GEnv.ScriptEngine->functor("loadscreen.get_tip_number", m_functor)); - tip_num = m_functor(map_name.c_str()); + if (GEnv.ScriptEngine->functor("loadscreen.get_tip_number", m_functor)) + tip_num = m_functor(map_name.c_str()); + else + noTips = true; } else { - R_ASSERT(GEnv.ScriptEngine->functor("loadscreen.get_mp_tip_number", m_functor)); - tip_num = m_functor(map_name.c_str()); + if (GEnv.ScriptEngine->functor("loadscreen.get_mp_tip_number", m_functor)) + tip_num = m_functor(map_name.c_str()); + else + noTips = true; } - // tip_num = 83; + if (noTips) + return; + xr_sprintf(buff, "%s%d:", StringTable().translate("ls_tip_number").c_str(), tip_num); shared_str tmp = buff;