diff --git a/src/gui/touchscreengui.cpp b/src/gui/touchscreengui.cpp index debbaa4db..5eba88c13 100644 --- a/src/gui/touchscreengui.cpp +++ b/src/gui/touchscreengui.cpp @@ -2,7 +2,7 @@ Copyright (C) 2014 sapier Copyright (C) 2018 srifqi, Muhammad Rifqi Priyo Susanto -Copyright (C) 2014-2020 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua +Copyright (C) 2014-2022 Maksim Gamarnik [MoNTE48] Maksym48@pm.me This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -632,6 +632,8 @@ void TouchScreenGUI::init(ISimpleTextureSource *tsrc) m_screensize.X, button_size), L"Chat", false); + + m_buttons_initialized = true; } touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y) @@ -1146,6 +1148,9 @@ TouchScreenGUI::~TouchScreenGUI() } } + if (!m_buttons_initialized) + return; + if (m_joystick_btn_off->guibutton) { m_joystick_btn_off->guibutton->drop(); m_joystick_btn_off->guibutton = nullptr; diff --git a/src/gui/touchscreengui.h b/src/gui/touchscreengui.h index d3ad7e365..e1eac7f5b 100644 --- a/src/gui/touchscreengui.h +++ b/src/gui/touchscreengui.h @@ -1,6 +1,6 @@ /* Copyright (C) 2014 sapier -Copyright (C) 2014-2020 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua +Copyright (C) 2014-2022 Maksim Gamarnik [MoNTE48] Maksym48@pm.me This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -215,6 +215,7 @@ private: std::map> m_hud_rects; std::map m_hud_ids; bool m_visible; // is the gui visible + bool m_buttons_initialized = false; // value in degree double m_camera_yaw_change = 0.0;