ICU-6132 If locale could not be created, return default one.

X-SVN-Rev: 23236
This commit is contained in:
Michael Ow 2008-01-14 23:30:51 +00:00
parent 5bdd0a03d1
commit d717772bbd

View file

@ -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) {