Bug 1572252 - Properly null-check a variable in debug-only code.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 22 Aug 2019 13:05:44 +0000
changeset 553192 6e0106677f6d1b102ecb33ff2445f5d8691bcdb3
parent 553191 f13cc22152082bdb6bda2481a543c1adf991f824
child 553193 bf99d92d78057971af4c3db8b24c482ccb0654d5
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1572252
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1572252 - Properly null-check a variable in debug-only code. Differential Revision: https://phabricator.services.mozilla.com/D43054
layout/style/GeckoBindings.cpp
--- a/layout/style/GeckoBindings.cpp
+++ b/layout/style/GeckoBindings.cpp
@@ -1498,18 +1498,19 @@ void Gecko_AddRefnsIReferrerInfoArbitrar
 }
 void Gecko_ReleasensIReferrerInfoArbitraryThread(nsIReferrerInfo* aPtr) {
   NS_RELEASE(aPtr);
 }
 
 void Gecko_nsIReferrerInfo_Debug(nsIReferrerInfo* aReferrerInfo,
                                  nsCString* aOut) {
   if (aReferrerInfo) {
-    nsCOMPtr<nsIURI> referrer = aReferrerInfo->GetComputedReferrer();
-    *aOut = referrer->GetSpecOrDefault();
+    if (nsCOMPtr<nsIURI> referrer = aReferrerInfo->GetComputedReferrer()) {
+      *aOut = referrer->GetSpecOrDefault();
+    }
   }
 }
 
 template <typename ElementLike>
 void DebugListAttributes(const ElementLike& aElement, nsCString& aOut) {
   const uint32_t kMaxAttributeLength = 40;
 
   uint32_t i = 0;