From d853240eeea01cae0ae95be85a467b34054eca13 Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Mon, 5 Sep 2016 21:59:34 +0100 Subject: CLOUD: Do not error out when loading icon if OSD format is not 2 or 4 Bpp Graphics::TransparentSurface::convertTo() errors out when the destination format is not 2 or 4 Bpp. But in the case of the cloud icon we can recover from it. So just print a warning and don't close the application. --- backends/networking/curl/cloudicon.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backends/networking/curl/cloudicon.cpp b/backends/networking/curl/cloudicon.cpp index fd587f9b5d..3ae6fd225e 100644 --- a/backends/networking/curl/cloudicon.cpp +++ b/backends/networking/curl/cloudicon.cpp @@ -122,7 +122,11 @@ void CloudIcon::loadIcon(Graphics::TransparentSurface &icon, byte *data, uint32 if (s) { Graphics::PixelFormat f = g_system->getOSDFormat(); if (f != s->format) { - Graphics::TransparentSurface *s2 = s->convertTo(f); + // Graphics::TransparentSurface::convertTo(f) errors out if the format is not 2Bpp or 4Bpp. + // We don't need to error out as we can recover from it. So check the format before calling convertTo(f); + Graphics::TransparentSurface *s2 = nullptr; + if (f.bytesPerPixel == 2 || f.bytesPerPixel == 4) + s2 = s->convertTo(f); if (s2) icon.copyFrom(*s2); else -- cgit v1.2.3