Bug 861106: Add null check for mDocument in SetTextZoom, SetFullZoom, and SetMinFontSize to prevent crash on tab close. [r=blassey]

This commit is contained in:
Scott Johnson 2013-05-01 17:21:47 -05:00
Родитель 7a26e938a0
Коммит 621376f7f2
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -2793,6 +2793,11 @@ SetExtResourceFullZoom(nsIDocument* aDocument, void* aClosure)
NS_IMETHODIMP
nsDocumentViewer::SetTextZoom(float aTextZoom)
{
// If we don't have a document, then we need to bail.
if (!mDocument) {
return NS_ERROR_FAILURE;
}
if (GetIsPrintPreview()) {
return NS_OK;
}
@ -2830,6 +2835,11 @@ nsDocumentViewer::GetTextZoom(float* aTextZoom)
NS_IMETHODIMP
nsDocumentViewer::SetMinFontSize(int32_t aMinFontSize)
{
// If we don't have a document, then we need to bail.
if (!mDocument) {
return NS_ERROR_FAILURE;
}
if (GetIsPrintPreview()) {
return NS_OK;
}
@ -2895,6 +2905,11 @@ nsDocumentViewer::SetFullZoom(float aFullZoom)
}
#endif
// If we don't have a document, then we need to bail.
if (!mDocument) {
return NS_ERROR_FAILURE;
}
mPageZoom = aFullZoom;
struct ZoomInfo ZoomInfo = { aFullZoom };