1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix crash if display resolution is not set (#7950)

On my wayland / gnome3 setup DisplayHeightMM() returns 0. This resulted in a
misleading startup error suggesting to fix my font paths.
This commit is contained in:
Martin Renold 2018-12-08 16:26:04 +01:00 committed by Loïc Blot
parent f0dca284b3
commit b02effdab9
2 changed files with 14 additions and 12 deletions

View file

@ -315,6 +315,11 @@ void FontEngine::initFont(unsigned int basesize, FontMode mode)
}
u32 size = std::floor(RenderingEngine::getDisplayDensity() *
m_settings->getFloat("gui_scaling") * basesize);
if (size == 0) {
errorstream << "FontEngine: attempt to use font size 0" << std::endl;
errorstream << " display density: " << RenderingEngine::getDisplayDensity() << std::endl;
abort();
}
u32 font_shadow = 0;
u32 font_shadow_alpha = 0;