make stringbundles a little more bullet-proof - don't crash when the bundle couldn't be loaded

This commit is contained in:
alecf%netscape.com 2000-04-27 02:17:17 +00:00
Родитель 321e5f060e
Коммит c8adccf97e
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -118,6 +118,7 @@ nsStringBundle::~nsStringBundle()
nsresult
nsStringBundle::GetStringFromID(PRInt32 aID, nsString& aResult)
{
NS_ENSURE_TRUE(mProps, NS_ERROR_UNEXPECTED);
nsAutoCMonitor(this);
nsAutoString name;
name.AppendInt(aID, 10);
@ -136,7 +137,7 @@ nsStringBundle::GetStringFromID(PRInt32 aID, nsString& aResult)
nsresult
nsStringBundle::GetStringFromName(const nsString& aName, nsString& aResult)
{
nsAutoCMonitor(this);
NS_ENSURE_TRUE(mProps, NS_ERROR_FAILURE);
nsresult ret = mProps->GetStringProperty(aName, aResult);
#ifdef DEBUG_tao
char *s = aResult.ToNewCString(),
@ -173,6 +174,7 @@ nsStringBundle::GetStringFromID(PRInt32 aID, PRUnichar **aResult)
NS_IMETHODIMP
nsStringBundle::GetStringFromName(const PRUnichar *aName, PRUnichar **aResult)
{
nsAutoCMonitor(this);
*aResult = nsnull;
nsString tmpstr;
nsString nameStr(aName);