summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-05-29 13:28:55 +0000
committerManolo Gouy <Manolo>2014-05-29 13:28:55 +0000
commit67f3c4cc828806d1668abc8b3ae3d883c23a63ab (patch)
tree64e241aa058cb030badeb9cdaf9bc5a3fbfeed97 /src
parent1cd5e78946f0b869e01c88a1081d9bdee8cc9cb4 (diff)
Avoid crash when XftFontOpenPattern() returns NULL.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10175 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/fl_font_xft.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fl_font_xft.cxx b/src/fl_font_xft.cxx
index c69d39f0f..7e629aa87 100644
--- a/src/fl_font_xft.cxx
+++ b/src/fl_font_xft.cxx
@@ -270,7 +270,10 @@ static XftFont* fontopen(const char* name, Fl_Fontsize size, bool core, int angl
free(picked_name);
#endif
- if (!match_pat) {
+ // open the matched font
+ if (match_pat) the_font = XftFontOpenPattern(fl_display, match_pat);
+
+ if (!match_pat || !the_font) {
// last chance, just open any font in the right size
the_font = XftFontOpen (fl_display, fl_screen,
XFT_FAMILY, XftTypeString, "sans",
@@ -284,9 +287,6 @@ static XftFont* fontopen(const char* name, Fl_Fontsize size, bool core, int angl
return the_font;
}
- // open the matched font
- the_font = XftFontOpenPattern(fl_display, match_pat);
-
#if 0 // diagnostic to print the "full name" of the font we actually opened. This works.
FcChar8 *picked_name2 = FcNameUnparse(the_font->pattern);
printf("Open : %s\n", picked_name2);