From 24a634066389967481e5f26883f5059c5ca5fe97 Mon Sep 17 00:00:00 2001 From: "martijn.martijn%gmail.com" Date: Thu, 12 Oct 2006 13:25:02 +0000 Subject: [PATCH] Bug 352666 - Crash [@ nsPrefBranch::SetComplexValue], r=dveditz, sr=bzbarsky --- modules/libpref/src/nsPrefBranch.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/libpref/src/nsPrefBranch.cpp b/modules/libpref/src/nsPrefBranch.cpp index d4713d2f881..2d19b2cec9a 100644 --- a/modules/libpref/src/nsPrefBranch.cpp +++ b/modules/libpref/src/nsPrefBranch.cpp @@ -385,6 +385,8 @@ NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & if (aType.Equals(NS_GET_IID(nsILocalFile))) { nsCOMPtr file = do_QueryInterface(aValue); + if (!file) + return NS_NOINTERFACE; nsCAutoString descriptorString; rv = file->GetPersistentDescriptor(descriptorString); @@ -402,7 +404,7 @@ NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & nsCOMPtr file; relFilePref->GetFile(getter_AddRefs(file)); if (!file) - return NS_ERROR_FAILURE; + return NS_NOINTERFACE; nsCAutoString relativeToKey; (void) relFilePref->GetRelativeToKey(relativeToKey); @@ -459,6 +461,8 @@ NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & // This is deprecated and you should not be using it if (aType.Equals(NS_GET_IID(nsIFileSpec))) { nsCOMPtr file = do_QueryInterface(aValue); + if (!file) + return NS_NOINTERFACE; nsXPIDLCString descriptorString; rv = file->GetPersistentDescriptorString(getter_Copies(descriptorString));