From 422639fb60234dad3c139c3d2395d5d51f28f70f Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Sun, 13 Dec 2015 02:00:19 +0100 Subject: [PATCH] layout/text.rs: Add assertion for empty fontgroup --- components/layout/text.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/layout/text.rs b/components/layout/text.rs index d28cea4c0e2..c8ef3ad2b5d 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -186,6 +186,8 @@ impl TextRunScanner { // Search for the first font in this font group that contains a glyph for this // character. let mut font_index = 0; + // The following code panics one way or another if this condition isn't met. + assert!(fontgroup.fonts.len() > 0); while font_index < fontgroup.fonts.len() - 1 { if fontgroup.fonts.get(font_index).unwrap().borrow() .glyph_index(character)