Bug 1404045 - Follow-up: Protect against Tell() failure. r=baku
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -467,19 +467,19 @@ nsresult nsMsgProtocol::LoadUrl(nsIURI *
{
// open buffered, asynchronous input stream
rv = m_transport->OpenInputStream(0, 0, 0, getter_AddRefs(m_inputStream));
if (NS_FAILED(rv)) return rv;
}
int64_t offset = 0;
nsCOMPtr<nsISeekableStream> seekable(do_QueryInterface(m_inputStream));
- if (seekable)
- seekable->Tell(&offset);
-
+ if (seekable && NS_FAILED(seekable->Tell(&offset))) {
+ offset = 0;
+ }
// m_readCount can be -1 which means "read as much as we can".
// We pass this on as UINT64_MAX, which is in fact uint64_t(-1).
RefPtr<SlicedInputStream> slicedStream =
new SlicedInputStream(m_inputStream, uint64_t(offset),
m_readCount == -1 ? UINT64_MAX : uint64_t(m_readCount));
nsCOMPtr<nsIInputStreamPump> pump;
rv = NS_NewInputStreamPump(getter_AddRefs(pump), slicedStream);
if (NS_FAILED(rv)) return rv;