diff --git a/ipc/glue/InputStreamUtils.cpp b/ipc/glue/InputStreamUtils.cpp index b5c70138b7d4..7ce98ffba095 100644 --- a/ipc/glue/InputStreamUtils.cpp +++ b/ipc/glue/InputStreamUtils.cpp @@ -114,11 +114,16 @@ void SerializeInputStreamAsPipeInternal(nsIInputStream* aInputStream, return; } } - MOZ_DIAGNOSTIC_ASSERT(asyncStream); - aParams = IPCRemoteStreamParams( - aDelayedStart, IPCStreamSource::Create(asyncStream, aManager), length); + auto* streamSource = IPCStreamSource::Create(asyncStream, aManager); + if (NS_WARN_IF(!streamSource)) { + // Failed to create IPCStreamSource, which would cause a failure should we + // attempt to serialize it later. So abort now. + return; + } + + aParams = IPCRemoteStreamParams(aDelayedStart, streamSource, length); } } // namespace