Bug 691976 - NULL check the JSContext before using JS_updateMallocCounter. r=Bas

This commit is contained in:
Matt Woodrow 2011-10-26 16:13:24 +13:00
parent 6b37a39ade
commit 45907293a3

View File

@ -1264,7 +1264,10 @@ nsCanvasRenderingContext2DAzure::SetDimensions(PRInt32 width, PRInt32 height)
}
gCanvasAzureMemoryUsed += width * height * 4;
JS_updateMallocCounter(nsContentUtils::GetCurrentJSContext(), width * height * 4);
JSContext* context = nsContentUtils::GetCurrentJSContext();
if (context) {
JS_updateMallocCounter(context, width * height * 4);
}
}
return InitializeWithTarget(target, width, height);