diff options
author | louis <louis.braun@gmx.de> | 2013-12-06 16:27:30 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-12-06 16:27:30 +0100 |
commit | 75303d3102717309422d9024b144630b1f623240 (patch) | |
tree | 03c78a12bfe290c6d1eaeb0181b488f42c6b9bfc | |
parent | 67b97d1b9212e9266d0c1809882e603bafaa5be9 (diff) | |
download | skin-nopacity-75303d3102717309422d9024b144630b1f623240.tar.gz skin-nopacity-75303d3102717309422d9024b144630b1f623240.tar.bz2 |
added more Exception Handling for Image Loading
-rw-r--r-- | HISTORY | 2 | ||||
-rw-r--r-- | imagemagickwrapper.c | 18 |
2 files changed, 17 insertions, 3 deletions
@@ -387,4 +387,4 @@ Version 1.0.0 Version 1.0.1 - fixed a bug in cImageLoader::FirstImageInFolder() - +- added more Exception Handling for Image Loading diff --git a/imagemagickwrapper.c b/imagemagickwrapper.c index 93a7706..8aa6136 100644 --- a/imagemagickwrapper.c +++ b/imagemagickwrapper.c @@ -77,7 +77,14 @@ bool cImageMagickWrapper::LoadImage(std::string FileName, std::string Path, std: buffer.read(imgFile.c_str()); if (config.GetValue("debugImageLoading")) dsyslog("nopacity: %s sucessfully loaded", imgFile.c_str()); - } catch (...) { + } catch( Magick::Warning &warning ) { + dsyslog("nopacity: Magick Warning: %s", warning.what()); + return true; + } catch( Magick::Error &error ) { + dsyslog("nopacity: Magick Error: %s", error.what()); + return false; + } catch(...) { + dsyslog("nopacity: an unknown Magick error occured during image loading"); return false; } return true; @@ -92,7 +99,14 @@ bool cImageMagickWrapper::LoadImage(const char *fullpath) { buffer.read(fullpath); if (config.GetValue("debugImageLoading")) dsyslog("nopacity: %s sucessfully loaded", fullpath); - } catch (...) { + } catch( Magick::Warning &warning ) { + dsyslog("nopacity: Magick Warning: %s", warning.what()); + return true; + } catch( Magick::Error &error ) { + dsyslog("nopacity: Magick Error: %s", error.what()); + return false; + } catch(...) { + dsyslog("nopacity: an unknown Magick error occured during image loading"); return false; } return true; |