Make nsSupportsHashtable not crash when you try to Get or Remove an item

not in the table already.
This commit is contained in:
shaver@netscape.com
1999-09-02 07:01:53 +00:00
parent b703a644da
commit 9404d98db8

View File

@@ -401,6 +401,8 @@ void*
nsSupportsHashtable::Get(nsHashKey *aKey)
{
void* data = nsHashtable::Get(aKey);
if (!data)
return nsnull;
nsISupports* element = NS_STATIC_CAST(nsISupports*, data);
NS_ADDREF(element);
return data;
@@ -410,6 +412,8 @@ void*
nsSupportsHashtable::Remove(nsHashKey *aKey)
{
void* data = nsHashtable::Remove(aKey);
if (!data)
return nsnull;
nsISupports* element = NS_STATIC_CAST(nsISupports*, data);
NS_RELEASE(element);
return data;