diff --git a/toolkit/components/url-classifier/src/nsUrlClassifierUtils.cpp b/toolkit/components/url-classifier/src/nsUrlClassifierUtils.cpp index 50ce3de69517..fbcb9c552e4b 100644 --- a/toolkit/components/url-classifier/src/nsUrlClassifierUtils.cpp +++ b/toolkit/components/url-classifier/src/nsUrlClassifierUtils.cpp @@ -225,7 +225,7 @@ nsUrlClassifierUtils::CleanupHostname(const nsACString & hostname, } // cut off trailing dots - while (_retval[_retval.Length() - 1] == '.') { + while (_retval.Length() > 0 && _retval[_retval.Length() - 1] == '.') { _retval.SetLength(_retval.Length() - 1); } }