1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 19:27:35 +00:00

FontEditor: Normalize GlyphMap selection before creating UndoSelection

Fixes bogus indexing crashes when creating new restore states.
This commit is contained in:
thankyouverycool 2022-07-05 09:50:20 -04:00 committed by Andreas Kling
parent 9962a744eb
commit ae333fad98

View file

@ -622,7 +622,8 @@ ErrorOr<void> FontEditorWidget::initialize(String const& path, RefPtr<Gfx::Bitma
i++;
}
m_undo_selection = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) UndoSelection(m_glyph_map_widget->selection().start(), m_glyph_map_widget->selection().size(), m_glyph_map_widget->active_glyph(), *m_edited_font)));
auto selection = m_glyph_map_widget->selection().normalized();
m_undo_selection = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) UndoSelection(selection.start(), selection.size(), m_glyph_map_widget->active_glyph(), *m_edited_font)));
m_undo_stack->clear();
update_statusbar();