From fddd7773990ac9e8f82f87568d5d0ee2f68e914a Mon Sep 17 00:00:00 2001 From: JuiceyDev Date: Fri, 6 Mar 2026 00:34:36 +0100 Subject: [PATCH] fixed font --- Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp | 12 ++++++++++-- Minecraft.Client/Build/Common/UI/UIFontData.cpp | 10 ++++++++++ Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp | 11 ++--------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp index ab03b05ef..c6b791b8e 100644 --- a/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Build/Common/UI/UIBitmapFont.cpp @@ -98,9 +98,17 @@ UIBitmapFont::UIBitmapFont( SFontData &sfontdata ) BufferedImage bimg(sfontdata.m_wstrFilename); int *bimgData = bimg.getData(); - + + if (bimgData == nullptr) + { + fprintf(stderr, "[UIBitmapFont] ERROR: failed to load font image for '%s' — font file missing or corrupt.\n", + sfontdata.m_strFontName.c_str()); + m_cFontData = new CFontData(); // default/empty — avoids null deref downstream + return; + } + m_cFontData = new CFontData(sfontdata, bimgData); - + //delete [] bimgData; } diff --git a/Minecraft.Client/Build/Common/UI/UIFontData.cpp b/Minecraft.Client/Build/Common/UI/UIFontData.cpp index 9a7e91282..c68e84974 100644 --- a/Minecraft.Client/Build/Common/UI/UIFontData.cpp +++ b/Minecraft.Client/Build/Common/UI/UIFontData.cpp @@ -155,6 +155,16 @@ CFontData::CFontData(SFontData &sFontData, int *pbRawImage) { this->m_sFontData = &sFontData; + if (pbRawImage == nullptr) + { + // Font image failed to load; leave raw buffers null so the font renders nothing + // rather than crashing. UIBitmapFont already logs an error in this case. + m_pbRawImage = nullptr; + m_kerningTable = nullptr; + m_pfAdvanceTable = nullptr; + return; + } + // INITIALISE ALPHA CHANNEL // // Glyph Archive (1Byte per pixel). diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 64128fc45..670a6bed0 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -669,15 +669,8 @@ app.DebugPrintf("---ReadProductCodes()\n"); app.loadMediaArchive(); app.loadStringTable(); - // Use the actual framebuffer dimensions so the UI scales to whatever - // window/fullscreen resolution was chosen at startup. - { - int uiW = 1920, uiH = 1080; - RenderManager.GetFramebufferSize(uiW, uiH); - if (uiW < 1) uiW = 1920; - if (uiH < 1) uiH = 1080; - ui.init(uiW, uiH); - } + // fuck you + ui.init(1920, 1080); // storage manager is needed for the trial key check StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,"");