From d717772bbdc8500e2b1b8e4c50f50ac1088ec9d6 Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Mon, 14 Jan 2008 23:30:51 +0000 Subject: [PATCH] ICU-6132 If locale could not be created, return default one. X-SVN-Rev: 23236 --- icu4c/source/common/resbund.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/resbund.cpp b/icu4c/source/common/resbund.cpp index c4b853293ea..082c5ab01f4 100644 --- a/icu4c/source/common/resbund.cpp +++ b/icu4c/source/common/resbund.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1997-2006, International Business Machines +* Copyright (C) 1997-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -375,6 +375,10 @@ const Locale &ResourceBundle::getLocale(void) const UErrorCode status = U_ZERO_ERROR; const char *localeName = ures_getLocale(fResource, &status); Locale *tLocale = new Locale(localeName); + // Null pointer check + if (tLocale == NULL) { + return Locale::getDefault(); // Return default locale if one could not be created. + } umtx_lock(NULL); ResourceBundle *me = (ResourceBundle *)this; // semantically const if (me->fLocale == NULL) {