Code

patch from 226459, approved by joel
authorbuliabyak <buliabyak@users.sourceforge.net>
Fri, 20 Jun 2008 16:38:39 +0000 (16:38 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Fri, 20 Jun 2008 16:38:39 +0000 (16:38 +0000)
src/ui/dialog/filedialogimpl-win32.cpp

index d26762bd3c27547249f7332a067367cecfecdd2f..f9eab673a33f92c1fcea9391aa9ed504a6b1ae74 100644 (file)
@@ -938,18 +938,26 @@ bool FileOpenDialogImplWin32::set_image_preview()
 {
     const Glib::ustring path = utf16_to_ustring(_path_string, _MAX_PATH);
 
+    bool successful = false;
+
     _mutex->lock();
-    _preview_bitmap_image = Gdk::Pixbuf::create_from_file(path);
-    if(!_preview_bitmap_image) return false;
 
-    _preview_image_width = _preview_bitmap_image->get_width();
-    _preview_document_width = _preview_image_width;
-    _preview_image_height = _preview_bitmap_image->get_height();
-    _preview_document_height = _preview_image_height;
+    try {
+        _preview_bitmap_image = Gdk::Pixbuf::create_from_file(path);
+        if (_preview_bitmap_image) {
+            _preview_image_width = _preview_bitmap_image->get_width();
+            _preview_document_width = _preview_image_width;
+            _preview_image_height = _preview_bitmap_image->get_height();
+            _preview_document_height = _preview_image_height;
+            successful = true;
+        }
+    }
+    catch (const Gdk::PixbufError&) {}
+    catch (const Glib::FileError&) {}
 
     _mutex->unlock();
 
-    return true;
+    return successful;
 }
 
 void FileOpenDialogImplWin32::render_preview()