diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 0051ce5cd446..b4dbb8164822 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -7756,8 +7756,12 @@ nsDocShell::SetDocCurrentStateObj(nsISHEntry *shEntry) NS_ENSURE_TRUE(document, NS_ERROR_FAILURE); nsCOMPtr scContainer; - nsresult rv = shEntry->GetStateData(getter_AddRefs(scContainer)); - NS_ENSURE_SUCCESS(rv, rv); + if (shEntry) { + nsresult rv = shEntry->GetStateData(getter_AddRefs(scContainer)); + NS_ENSURE_SUCCESS(rv, rv); + + // If shEntry is null, just set the document's state object to null. + } // It's OK for scContainer too be null here; that just means there's no // state data associated with this history entry.