mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-03 05:57:40 -05:00
fix: Crash when no plugins could be loaded
This commit is contained in:
@@ -1030,7 +1030,7 @@ namespace hex {
|
||||
void Font::push(float size) const {
|
||||
auto font = getFont(m_fontName);
|
||||
|
||||
if (size <= 0.0F) {
|
||||
if (size <= 0.0F && font != nullptr) {
|
||||
size = font->LegacySize;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,12 @@ namespace hex {
|
||||
}
|
||||
|
||||
ImFont* getFont(const UnlocalizedString &fontName) {
|
||||
return (*impl::s_fontDefinitions)[fontName];
|
||||
auto it = impl::s_fontDefinitions->find(fontName);
|
||||
|
||||
if (it == impl::s_fontDefinitions->end())
|
||||
return ImGui::GetDefaultFont();
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void setDefaultFont(const Font& font) {
|
||||
@@ -1124,6 +1129,10 @@ namespace hex {
|
||||
}
|
||||
|
||||
const Font& getDefaultFont() {
|
||||
if (*impl::s_defaultFont == nullptr) {
|
||||
static Font emptyFont("");
|
||||
return emptyFont;
|
||||
}
|
||||
return **impl::s_defaultFont;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user