summaryrefslogtreecommitdiff
path: root/pango/pangocoretext-fontmap.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@loopnest.org>2015-05-29 21:33:21 +0200
committerKristian Rietveld <kris@loopnest.org>2015-05-29 22:16:18 +0200
commitea326fdf0d2c12ef0d4c58882b795caa3f0050bc (patch)
treeb5080daf2763cb5323955a60acbc14cdc9b0e13f /pango/pangocoretext-fontmap.c
parent01a609cd7b0fbd4b01c73f5e737a4722e65e5969 (diff)
downloadpango-ea326fdf0d2c12ef0d4c58882b795caa3f0050bc.tar.gz
coretext: guard for unset language
Fixes bug #750017
Diffstat (limited to 'pango/pangocoretext-fontmap.c')
-rw-r--r--pango/pangocoretext-fontmap.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 1b64f626..27132c4d 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -1593,19 +1593,27 @@ pango_core_text_fontset_new (PangoCoreTextFontsetKey *key,
/* Add the cascade list for this language */
#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8
{
- CFArrayRef language_pref_list;
+ CFArrayRef language_pref_list = NULL;
CFStringRef languages[1];
- languages[0] = CFStringCreateWithCString (NULL,
- pango_language_to_string (key->language),
- kCFStringEncodingASCII);
- language_pref_list = CFArrayCreate (kCFAllocatorDefault,
- (const void **) languages,
- 1,
- &kCFTypeArrayCallBacks);
+ if (key->language)
+ {
+ languages[0] = CFStringCreateWithCString (NULL,
+ pango_language_to_string (key->language),
+ kCFStringEncodingASCII);
+ language_pref_list = CFArrayCreate (kCFAllocatorDefault,
+ (const void **) languages,
+ 1,
+ &kCFTypeArrayCallBacks);
+ }
+
fontset->cascade_list = CTFontCopyDefaultCascadeListForLanguages (pango_core_text_font_get_ctfont (best_font), language_pref_list);
- CFRelease (languages[0]);
- CFRelease (language_pref_list);
+
+ if (language_pref_list)
+ {
+ CFRelease (languages[0]);
+ CFRelease (language_pref_list);
+ }
}
#else
/* There is unfortunately no public API to retrieve the cascade list