ICU-527 Don't crash if setlocale() returns NULL

X-SVN-Rev: 2099
This commit is contained in:
Steven R. Loomis 2000-08-02 19:36:19 +00:00
parent afbd051d76
commit 6fa70ecf4a

View File

@ -1268,8 +1268,10 @@ static const char *uprv_getPOSIXID()
if (posixID == 0) posixID = getenv("LANG");
if (posixID == 0) posixID = setlocale(LC_ALL, NULL);
if ( (uprv_strcmp("C", posixID) == 0) ||
(uprv_strncmp("C ", posixID, 2) == 0) ) { /* HPUX returns 'C C C C C C C' */
if ( (posixID==0) ||
(uprv_strcmp("C", posixID) == 0) ||
(uprv_strncmp("C ", posixID, 2) == 0) )
{ /* HPUX returns 'C C C C C C C' */
posixID = "en_US";
}
return posixID;