Skip to content

Commit 41ee54e

Browse files
committed
qt: use fallback weight if weightFromArg fails
1 parent 34d1d16 commit 41ee54e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/qt/optionsmodel.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ bool OptionsModel::Init(bilingual_str& error)
261261
} else if (GUIUtil::fontsLoaded()) {
262262
int raw_weight = SettingToInt(node().getPersistentSetting("font-weight-normal"), GUIUtil::weightToArg(GUIUtil::g_font_defaults.weight_normal));
263263
QFont::Weight weight;
264-
GUIUtil::weightFromArg(raw_weight, weight);
265-
if (!GUIUtil::isSupportedWeight(weight)) {
264+
if (!GUIUtil::weightFromArg(raw_weight, weight) || !GUIUtil::isSupportedWeight(weight)) {
266265
weight = GUIUtil::supportedWeightFromIndex(GetFallbackWeightIndex(/*is_bold=*/false));
267266
node().forceSetting("font-weight-normal", GUIUtil::weightToArg(weight));
268267
}
@@ -274,8 +273,7 @@ bool OptionsModel::Init(bilingual_str& error)
274273
} else if (GUIUtil::fontsLoaded()) {
275274
QFont::Weight weight;
276275
int raw_weight = SettingToInt(node().getPersistentSetting("font-weight-bold"), GUIUtil::weightToArg(GUIUtil::g_font_defaults.weight_bold));
277-
GUIUtil::weightFromArg(raw_weight, weight);
278-
if (!GUIUtil::isSupportedWeight(weight)) {
276+
if (!GUIUtil::weightFromArg(raw_weight, weight) || !GUIUtil::isSupportedWeight(weight)) {
279277
weight = GUIUtil::supportedWeightFromIndex(GetFallbackWeightIndex(/*is_bold=*/true));
280278
node().forceSetting("font-weight-bold", GUIUtil::weightToArg(weight));
281279
}

0 commit comments

Comments
 (0)