Bug 843543 - Add a null-check after ShowPrintDialog to avoid crashing. r=smaug

This commit is contained in:
Mats Palmgren 2013-02-24 15:09:34 +01:00
parent 56ff9b26dd
commit 3cfffd0412

View File

@ -616,13 +616,16 @@ nsPrintEngine::DoCommonPrint(bool aIsPrintPreview,
// ShowPrintDialog triggers an event loop which means we can't assume
// that the state of this->{anything} matches the state we've checked
// above. Including that a given {thing} is non null.
if (!mPrt) {
return NS_ERROR_FAILURE;
}
if (NS_SUCCEEDED(rv)) {
// since we got the dialog and it worked then make sure we
// are telling GFX we want to print silent
printSilently = true;
if (mPrt && mPrt->mPrintSettings) {
if (mPrt->mPrintSettings) {
// The user might have changed shrink-to-fit in the print dialog, so update our copy of its state
mPrt->mPrintSettings->GetShrinkToFit(&mPrt->mShrinkToFit);
}