diff --git a/src/gameui/IConsole.cpp b/src/gameui/IConsole.cpp index 30e18dea..723cdd61 100644 --- a/src/gameui/IConsole.cpp +++ b/src/gameui/IConsole.cpp @@ -392,7 +392,7 @@ void CConsole::DrawAutoCompletePanel(void) ImGui::PushID(static_cast(i)); - if (con_autocomplete_window_textures.GetBool()) + if (m_autoCompleteTexturesLoaded && con_autocomplete_window_textures.GetBool()) { // Show the flag texture before the cvar name. const int mainTexIdx = GetFlagTextureIndex(suggest.flags); @@ -772,13 +772,14 @@ bool CConsole::LoadFlagIcons(void) ret = LoadTextureBuffer(reinterpret_cast(rFlagIcon.m_pData), // !TODO: Fall-back texture. static_cast(rFlagIcon.m_nSize), &rFlagIcon.m_idIcon, &rFlagIcon.m_nWidth, &rFlagIcon.m_nHeight); - IM_ASSERT(ret); - if (!ret) { + Assert(0, "Texture flags load failed for %i", i); break; } } + + m_autoCompleteTexturesLoaded = ret; return ret; } diff --git a/src/gameui/IConsole.h b/src/gameui/IConsole.h index c71ad20d..8f2acaef 100644 --- a/src/gameui/IConsole.h +++ b/src/gameui/IConsole.h @@ -149,6 +149,11 @@ private: // the autocomplete window to keep the current selection visible. bool m_autoCompletePosMoved; + // If the textures failed to load, this will remain false and no textures + // will be drawn in the autocomplete window. This is because if one fails + // to load, the indices will be incorrect. + bool m_autoCompleteTexturesLoaded; + // The position and rect of the autocomplete window, the pos is set to that // of the input text field + an offset to move it under the item. ImVec2 m_autoCompleteWindowPos;