Bug 1308606 - Crash in mozilla::safebrowsing::Classifier::UpdateHashStore. r?francois
MozReview-Commit-ID: FIl5cPFzGbl
--- a/toolkit/components/url-classifier/LookupCache.h
+++ b/toolkit/components/url-classifier/LookupCache.h
@@ -123,17 +123,17 @@ public:
virtual nsresult Open();
virtual nsresult Init() = 0;
virtual nsresult ClearPrefixes() = 0;
virtual nsresult Has(const Completion& aCompletion,
bool* aHas, bool* aComplete) = 0;
template<typename T>
static T* Cast(LookupCache* aThat) {
- return (T::VER == aThat->Ver() ? reinterpret_cast<T*>(aThat) : nullptr);
+ return ((aThat && T::VER == aThat->Ver()) ? reinterpret_cast<T*>(aThat) : nullptr);
}
private:
nsresult Reset();
nsresult LoadPrefixSet();
virtual nsresult StoreToFile(nsIFile* aFile) = 0;
virtual nsresult LoadFromFile(nsIFile* aFile) = 0;