Bug 1507907 - null check result of CFDateFormatterCreate. r=gandalf
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 19 Nov 2018 21:55:32 +0200
changeset 503542 c4aa7a5fe3e188220c21f4b478b49ad56a40a15a
parent 503541 29ff944efa40e929995f6b2660383041738266f0
child 503543 adec7f223b0292b8dc446ab6d4fe0883dfbdcaf9
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgandalf
bugs1507907
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507907 - null check result of CFDateFormatterCreate. r=gandalf
intl/locale/mac/OSPreferences_mac.cpp
--- a/intl/locale/mac/OSPreferences_mac.cpp
+++ b/intl/locale/mac/OSPreferences_mac.cpp
@@ -155,16 +155,19 @@ OSPreferences::ReadDateTimePattern(DateT
   if (!locale) {
     return false;
   }
 
   CFDateFormatterRef formatter =
     CFDateFormatterCreate(kCFAllocatorDefault, locale,
                           ToCFDateFormatterStyle(aDateStyle),
                           ToCFDateFormatterStyle(aTimeStyle));
+  if (!formatter) {
+    return false;
+  }
   CFStringRef format = CFDateFormatterGetFormat(formatter);
   CFRelease(locale);
 
   CFRange range = CFRangeMake(0, CFStringGetLength(format));
   aRetVal.SetLength(range.length);
   CFStringGetCharacters(format, range,
                         reinterpret_cast<UniChar*>(aRetVal.BeginWriting()));
   CFRelease(formatter);