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:
parent
f0dca284b3
commit
b02effdab9
2 changed files with 14 additions and 12 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue