From 8ffbcb313d4db26ffede61ffd6c7c57285ed4076 Mon Sep 17 00:00:00 2001 From: Liu Chao Date: Thu, 18 Jan 2018 22:27:22 +0800 Subject: [PATCH] fix(font): font selection has segmentation fault --- src/font/fontlibrary.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/font/fontlibrary.c b/src/font/fontlibrary.c index 0a8a5dde..e4398076 100644 --- a/src/font/fontlibrary.c +++ b/src/font/fontlibrary.c @@ -453,7 +453,7 @@ int LCUIFont_GetId( const char *family_name, LCUI_FontStyle style, LCUI_FontWeight weight ) { - LCUI_FontStyle s; + int style_num; LCUI_FontWeight w; LCUI_FontStyleNode snode; LCUI_FontFamilyNode fnode; @@ -468,8 +468,8 @@ int LCUIFont_GetId( const char *family_name, if( weight == 0 ) { weight = FONT_WEIGHT_NORMAL; } - for( s = style; s >= FONT_STYLE_NORMAL; --s ) { - snode = &fnode->styles[s]; + for( style_num = style; style_num >= 0; --style_num ) { + snode = &fnode->styles[style_num]; if( SelectFontWeight( snode, weight ) ) { return SelectFontWeight( snode, weight )->id; }