From b46c7da0a488b2e21d9ecaa8c78e7ebcbc2ed0ea Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 6 Mar 2019 19:04:30 +0100 Subject: [PATCH] FontEditor: Don't crash when clicking on the unused part of a glyph. --- Applications/FontEditor/FontEditor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp index 243cb7bde5..2207e2618f 100644 --- a/Applications/FontEditor/FontEditor.cpp +++ b/Applications/FontEditor/FontEditor.cpp @@ -269,8 +269,10 @@ void GlyphEditorWidget::draw_at_mouse(const GMouseEvent& event) int x = (event.x() - 1) / m_scale; int y = (event.y() - 1) / m_scale; auto bitmap = font().glyph_bitmap(m_glyph); - ASSERT(x < bitmap.width()); - ASSERT(y < bitmap.height()); + if (x >= bitmap.width()) + return; + if (y >= bitmap.height()) + return; if (bitmap.bit_at(x, y) == set) return; bitmap.set_bit_at(x, y, set);