Log exception and return null on xpm loading failure. Add copyright

This commit is contained in:
FreeSlave 2015-06-07 14:34:15 +03:00
parent 3638974bdf
commit c958169f88
2 changed files with 17 additions and 2 deletions

View File

@ -64,9 +64,15 @@ ColorDrawBuf loadImage(immutable ubyte[] data, string filename) {
import std.algorithm : endsWith; import std.algorithm : endsWith;
if (filename.endsWith(".xpm")) { if (filename.endsWith(".xpm")) {
import dlangui.graphics.xpm.reader; import dlangui.graphics.xpm.reader;
try {
return parseXPM(data); return parseXPM(data);
} }
catch(Exception e) {
Log.e("Failed to load image from file ", filename);
Log.e(to!string(e));
return null;
}
}
version (USE_DEIMAGE) { version (USE_DEIMAGE) {
try { try {

View File

@ -1,5 +1,14 @@
module dlangui.graphics.xpm.reader; module dlangui.graphics.xpm.reader;
/**
* Reading .xpm files.
*
* Copyright: Roman Chistokhodov, 2015
* License: Boost License 1.0
* Authors: Roman Chistokhodov, freeslave93@gmail.com
*
*/
import dlangui.graphics.xpm.colors; import dlangui.graphics.xpm.colors;
import dlangui.graphics.colors; import dlangui.graphics.colors;