diff --git a/dom/src/base/nsLocation.cpp b/dom/src/base/nsLocation.cpp index 461d7ea0091f..d7078504fc00 100644 --- a/dom/src/base/nsLocation.cpp +++ b/dom/src/base/nsLocation.cpp @@ -217,6 +217,12 @@ LocationImpl::GetURI(nsIURI** aURI) rv = webNav->GetCurrentURI(getter_AddRefs(uri)); NS_ENSURE_SUCCESS(rv, rv); + // It is valid for docshell to return a null URI. Don't try to fixup + // if this happens. + if (!uri) { + return NS_OK; + } + nsCOMPtr urifixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv)); NS_ENSURE_SUCCESS(rv, rv);