Bug 1749283 - Add a null check for mPrintTarget in nsDeviceContext::CreateRenderingContextCommon. r=dholbert
mPrintTarget can be nulled out and the caller needs to deal with null returns already, so this should address the crash. Differential Revision: https://phabricator.services.mozilla.com/D137473
This commit is contained in:
@@ -171,6 +171,11 @@ already_AddRefed<gfxContext> nsDeviceContext::CreateRenderingContextCommon(
|
||||
MOZ_ASSERT(IsPrinterContext());
|
||||
MOZ_ASSERT(mWidth > 0 && mHeight > 0);
|
||||
|
||||
if (NS_WARN_IF(!mPrintTarget)) {
|
||||
// Printing canceled already.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<gfx::DrawTarget> dt;
|
||||
if (aWantReferenceContext) {
|
||||
dt = mPrintTarget->GetReferenceDrawTarget();
|
||||
|
||||
Reference in New Issue
Block a user