mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-14 17:24:01 +00:00
ICU-6132 If locale could not be created, return default one.
X-SVN-Rev: 23236
This commit is contained in:
parent
5bdd0a03d1
commit
d717772bbd
1 changed files with 5 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue