summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-12-06 16:27:30 +0100
committerlouis <louis.braun@gmx.de>2013-12-06 16:27:30 +0100
commit75303d3102717309422d9024b144630b1f623240 (patch)
tree03c78a12bfe290c6d1eaeb0181b488f42c6b9bfc
parent67b97d1b9212e9266d0c1809882e603bafaa5be9 (diff)
downloadskin-nopacity-75303d3102717309422d9024b144630b1f623240.tar.gz
skin-nopacity-75303d3102717309422d9024b144630b1f623240.tar.bz2
added more Exception Handling for Image Loading
-rw-r--r--HISTORY2
-rw-r--r--imagemagickwrapper.c18
2 files changed, 17 insertions, 3 deletions
diff --git a/HISTORY b/HISTORY
index 0088052..5fdedb2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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;