зеркало из https://github.com/mozilla/pjs.git
Bug 134426 Set image as wallpaper crashes Mozilla (when Mozilla Wallpaper.bmp is Read-Only)
r=timeless, sr=hewitt return FAILURE instead of crashing when output stream can't be opend
This commit is contained in:
Родитель
d703b8275b
Коммит
3f2fc911e2
|
@ -881,18 +881,20 @@ WriteBitmap(nsString& aPath, gfxIImageFrame* aImage)
|
|||
|
||||
// write the bitmap headers and rgb pixel data to the file
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
PRUint32 written;
|
||||
stream->Write((const char*)&bf, sizeof(BITMAPFILEHEADER), &written);
|
||||
if (written == sizeof(BITMAPFILEHEADER)) {
|
||||
stream->Write((const char*)bmi, sizeof(BITMAPINFOHEADER), &written);
|
||||
if (written == sizeof(BITMAPINFOHEADER)) {
|
||||
stream->Write((const char*)bits, length, &written);
|
||||
if (written == length)
|
||||
rv = NS_OK;
|
||||
if (stream) {
|
||||
PRUint32 written;
|
||||
stream->Write((const char*)&bf, sizeof(BITMAPFILEHEADER), &written);
|
||||
if (written == sizeof(BITMAPFILEHEADER)) {
|
||||
stream->Write((const char*)bmi, sizeof(BITMAPINFOHEADER), &written);
|
||||
if (written == sizeof(BITMAPINFOHEADER)) {
|
||||
stream->Write((const char*)bits, length, &written);
|
||||
if (written == length)
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stream->Close();
|
||||
stream->Close();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче