diff --git a/xpcom/base/ClearOnShutdown.h b/xpcom/base/ClearOnShutdown.h index fb9bf1cc7234..4bc4aaaa0865 100644 --- a/xpcom/base/ClearOnShutdown.h +++ b/xpcom/base/ClearOnShutdown.h @@ -91,10 +91,12 @@ inline void KillClearOnShutdown() MOZ_ASSERT(NS_IsMainThread()); - ShutdownObserver *observer; - while ((observer = sShutdownObservers->popFirst())) { - observer->Shutdown(); - delete observer; + if (sShutdownObservers) { + ShutdownObserver *observer; + while ((observer = sShutdownObservers->popFirst())) { + observer->Shutdown(); + delete observer; + } } sShutdownObservers = nullptr;