Bug 656947 - NULL check the current canvas context when attempting to increment the malloc count. r=bz

This commit is contained in:
Matt Woodrow 2011-05-20 10:12:12 -07:00
Родитель 0b4b023267
Коммит d9a95cbf18
1 изменённых файлов: 4 добавлений и 1 удалений

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

@ -1132,7 +1132,10 @@ nsCanvasRenderingContext2D::SetDimensions(PRInt32 width, PRInt32 height)
}
gCanvasMemoryUsed += width * height * 4;
JS_updateMallocCounter(nsContentUtils::GetCurrentJSContext(), width * height * 4);
JSContext* context = nsContentUtils::GetCurrentJSContext();
if (context) {
JS_updateMallocCounter(context, width * height * 4);
}
}
return InitializeWithSurface(NULL, surface, width, height);