From c1070e692965f27e0865a4eeed0e025876502d1a Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Thu, 20 Oct 2016 19:20:51 +0200 Subject: CLOUD: Don't error out when PNG support is not enabled --- backends/cloud/cloudicon.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'backends/cloud/cloudicon.cpp') diff --git a/backends/cloud/cloudicon.cpp b/backends/cloud/cloudicon.cpp index 972efae57b..2adc7460d2 100644 --- a/backends/cloud/cloudicon.cpp +++ b/backends/cloud/cloudicon.cpp @@ -118,6 +118,11 @@ void CloudIcon::update() { break; } + if (!_icon.getPixels() || !_disabledIcon.getPixels()) { + // Loading the icons failed. Don't try to draw them. + return; + } + if (_state != kHidden) { makeAlphaIcon((_type == kDisabled ? _disabledIcon : _icon), _currentAlpha); g_system->displayActivityIconOnOSD(&_alphaIcon); @@ -137,11 +142,13 @@ void CloudIcon::initIcons() { void CloudIcon::loadIcon(Graphics::Surface &icon, byte *data, uint32 size) { Image::PNGDecoder decoder; Common::MemoryReadStream stream(data, size); - if (!decoder.loadStream(stream)) - error("CloudIcon::loadIcon: error decoding PNG"); + if (!decoder.loadStream(stream)) { + warning("CloudIcon::loadIcon: error decoding PNG"); + return; + } const Graphics::Surface *s = decoder.getSurface(); - return icon.copyFrom(*s); + icon.copyFrom(*s); } void CloudIcon::makeAlphaIcon(const Graphics::Surface &icon, float alpha) { -- cgit v1.2.3