Fix crash when invoking Lua console from the main menu

(cherry picked from commit 6ed57cdc70)

Fixes #3830
This commit is contained in:
Celtic Minstrel 2018-11-11 15:59:09 -05:00 committed by josteph
parent 649f2b8a3a
commit 21352b01e6

View file

@ -685,7 +685,7 @@ void lua_interpreter::controller::search(int direction)
/** Display a new console, using given video and lua kernel */
void lua_interpreter::display(lua_kernel_base * lk) {
#ifndef ALWAYS_HAVE_LUA_CONSOLE
if(!game_config::debug) {
if(!game_config::debug && resources::controller) {
display_chat_manager& chat_man = resources::controller->get_display().get_chat_manager();
const std::string& message = _("The lua console can only be used in debug mode! (Run ':debug' first)");
chat_man.add_chat_message(time(nullptr), _("lua console"), 0, message, events::chat_handler::MESSAGE_PRIVATE, false);