Bug 1507907 - null check result of CFDateFormatterCreate. r=gandalf r=jcristau
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Mon, 19 Nov 2018 21:55:32 +0200
changeset 501307 e68e1025c02887a9e0a419f166ddf02118b1b427
parent 501306 5021562e6baf153b5ff398b8315f4497b6ed3a64
child 501308 767930fe66d2ae68f97e33dcba861c8ebb3996c3
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgandalf, jcristau
bugs1507907
milestone64.0
Bug 1507907 - null check result of CFDateFormatterCreate. r=gandalf r=jcristau
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);