From 0e276e0458965ff41e007ad9e4e612b55bad7987 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Wed, 10 May 2023 17:00:16 -0400 Subject: [PATCH] FontEditor: Iterate slope and weight lists by size() --- Userland/Applications/FontEditor/MainWidget.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index 417c6a736f..027d6d32c4 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -643,21 +643,17 @@ ErrorOr MainWidget::initialize(DeprecatedString const& path, RefPtrset_value(m_edited_font->mean_line(), GUI::AllowCallback::No); m_baseline_spinbox->set_value(m_edited_font->baseline(), GUI::AllowCallback::No); - int i = 0; - for (auto& it : Gfx::font_weight_names) { - if (it.style == m_edited_font->weight()) { + for (size_t i = 0; i < Gfx::font_weight_names.size(); ++i) { + if (Gfx::font_weight_names[i].style == m_edited_font->weight()) { m_weight_combobox->set_selected_index(i, GUI::AllowCallback::No); break; } - i++; } - i = 0; - for (auto& it : Gfx::font_slope_names) { - if (it.style == m_edited_font->slope()) { + for (size_t i = 0; i < Gfx::font_slope_names.size(); ++i) { + if (Gfx::font_slope_names[i].style == m_edited_font->slope()) { m_slope_combobox->set_selected_index(i, GUI::AllowCallback::No); break; } - i++; } update_statusbar();