diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp
index a9b1da769f7e..4e32e3669d1f 100644
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -674,10 +674,10 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
Recycle(forceCharsetFromWebShell);
//TODO: we should define appropriate constant for force charset
charsetSource = kCharsetFromPreviousLoading;
- } else if ((dcInfo != NULL) && (override)) {
+ } else if ((dcInfo.get() != NULL) && (override)) {
nsCOMPtr csAtom;
dcInfo->GetForcedCharset(getter_AddRefs(csAtom));
- if (csAtom != NULL) {
+ if (csAtom.get() != NULL) {
csAtom->ToString(charset);
charsetSource = kCharsetFromPreviousLoading;
}
diff --git a/layout/html/document/src/nsHTMLDocument.cpp b/layout/html/document/src/nsHTMLDocument.cpp
index a9b1da769f7e..4e32e3669d1f 100644
--- a/layout/html/document/src/nsHTMLDocument.cpp
+++ b/layout/html/document/src/nsHTMLDocument.cpp
@@ -674,10 +674,10 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
Recycle(forceCharsetFromWebShell);
//TODO: we should define appropriate constant for force charset
charsetSource = kCharsetFromPreviousLoading;
- } else if ((dcInfo != NULL) && (override)) {
+ } else if ((dcInfo.get() != NULL) && (override)) {
nsCOMPtr csAtom;
dcInfo->GetForcedCharset(getter_AddRefs(csAtom));
- if (csAtom != NULL) {
+ if (csAtom.get() != NULL) {
csAtom->ToString(charset);
charsetSource = kCharsetFromPreviousLoading;
}