From ead562acb24d144cc17ce8af557d8ecf5f4f53a8 Mon Sep 17 00:00:00 2001
From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Thu, 19 Aug 2010 11:33:43 +0000
Subject: [PATCH] fix second part of BZDNG-152

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2659 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/gui/src/file_loader.cc | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/modules/gui/src/file_loader.cc b/modules/gui/src/file_loader.cc
index 40c819310..bf510dc37 100644
--- a/modules/gui/src/file_loader.cc
+++ b/modules/gui/src/file_loader.cc
@@ -40,7 +40,7 @@
 
 #include <ost/seq/sequence_list.hh>
 #include <ost/seq/alignment_handle.hh>
-
+#include <ost/seq/invalid_sequence.hh>
 #include <ost/gfx/entity.hh>
 #include <ost/gfx/surface.hh>
 #include <ost/gfx/scene.hh>
@@ -325,7 +325,8 @@ gfx::GfxObjP FileLoader::TryLoadSurface(const QString& filename, io::SurfaceIOHa
   return gfx::GfxObjP();
 }
 
-gfx::GfxObjP FileLoader::TryLoadAlignment(const QString& filename, io::SequenceIOHandlerPtr handler)
+gfx::GfxObjP FileLoader::TryLoadAlignment(const QString& filename, 
+                                          io::SequenceIOHandlerPtr handler)
 {
   if(!handler){
     try{
@@ -337,7 +338,16 @@ gfx::GfxObjP FileLoader::TryLoadAlignment(const QString& filename, io::SequenceI
   }
   if(handler){
     seq::SequenceList seq_list = seq::CreateSequenceList();
-    handler->Import(seq_list,filename.toStdString());
+    try {
+      handler->Import(seq_list,filename.toStdString());      
+    } catch(io::IOException& e) {
+      LOGN_ERROR(e.what());
+      return gfx::GfxObjP();
+    }
+    catch(seq::InvalidSequence& e) {
+      LOGN_ERROR(e.what());
+      return gfx::GfxObjP();
+    }
     seq::AlignmentHandle alignment = seq::AlignmentFromSequenceList(seq_list);
     gui::MainArea* main_area = gui::GostyApp::Instance()->GetPerspective()->GetMainArea();
     SequenceViewer* viewer = new SequenceViewer(true,main_area);
-- 
GitLab