summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;