Bug 975460 - check for null CTFontRef after creation. r=jfkthame
authorJohn Daggett <jdaggett@mozilla.com>
Tue, 25 Feb 2014 16:37:26 +0900
changeset 170686 8c1eb349d342d617e50e44d50e75b4f041613fe8
parent 170685 f2fcc1dea68868d8b86aa5825cd474f3543c88f6
child 170687 6d1aabc16a1b4e77e76e858d96a81db34df1f75c
child 170748 1507f021ac93c1d27cfd00e389fba1c9421b3201
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjfkthame
bugs975460
milestone30.0a1
Bug 975460 - check for null CTFontRef after creation. r=jfkthame
gfx/thebes/gfxMacPlatformFontList.mm
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -1073,16 +1073,20 @@ MacFontInfo::LoadFontFamilyData(const ns
 
         CTFontDescriptorRef faceDesc =
             (CTFontDescriptorRef)CFArrayGetValueAtIndex(matchingFonts, f);
         if (!faceDesc) {
             continue;
         }
         CTFontRef fontRef = CTFontCreateWithFontDescriptor(faceDesc,
                                                            0.0, nullptr);
+        if (!fontRef) {
+            NS_WARNING("failed to create a CTFontRef");
+            continue;
+        }
 
         if (mLoadCmaps) {
             // face name
             CFStringRef faceName = (CFStringRef)
                 CTFontDescriptorCopyAttribute(faceDesc, kCTFontNameAttribute);
 
             nsAutoTArray<UniChar, 1024> buffer;
             CFIndex len = CFStringGetLength(faceName);