Bug 1167557 - Crash when a null surface is passed to SurfaceCache::Insert. r=dholbert

This commit is contained in:
Seth Fowler 2015-07-01 16:09:21 -07:00
parent 76347c9f12
commit 8408489fa0

View File

@ -1023,6 +1023,11 @@ SurfaceCache::Insert(imgFrame* aSurface,
return InsertOutcome::FAILURE;
}
// Refuse null surfaces.
if (!aSurface) {
MOZ_CRASH("Don't pass null surfaces to SurfaceCache::Insert");
}
MutexAutoLock lock(sInstance->GetMutex());
Cost cost = ComputeCost(aSurface->GetSize(), aSurface->GetBytesPerPixel());
return sInstance->Insert(aSurface, cost, aImageKey, aSurfaceKey, aLifetime);