Fix crash in ReadImageSkiaFromICO when CreateSkBitmapFromHICON fails
This commit is contained in:
parent
a47e30dd82
commit
a886261518
1 changed files with 5 additions and 1 deletions
|
@ -160,10 +160,14 @@ base::win::ScopedHICON ReadICOFromPath(int size, const base::FilePath& path) {
|
|||
LR_LOADFROMFILE)));
|
||||
}
|
||||
|
||||
void ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon) {
|
||||
bool ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon) {
|
||||
// Convert the icon from the Windows specific HICON to gfx::ImageSkia.
|
||||
std::unique_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(icon));
|
||||
if (!bitmap)
|
||||
return false;
|
||||
|
||||
image->AddRepresentation(gfx::ImageSkiaRep(*bitmap, 1.0f));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue