From 6f72e98acbcdb204d6a9b2c0ba59ed9d3204afea Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Fri, 19 Nov 2010 15:38:49 +0100
Subject: [PATCH] protect LocalDistTest against empty model/ref

---
 modules/mol/alg/src/local_dist_test.cc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/mol/alg/src/local_dist_test.cc b/modules/mol/alg/src/local_dist_test.cc
index cea1ea47d..2d97aa915 100644
--- a/modules/mol/alg/src/local_dist_test.cc
+++ b/modules/mol/alg/src/local_dist_test.cc
@@ -1,3 +1,4 @@
+#include <ost/log.hh>
 #include <ost/mol/mol.hh>
 #include "local_dist_test.hh"
 
@@ -117,6 +118,14 @@ Real LocalDistTest(const EntityView& mdl, const EntityView& ref,
                    Real cutoff, Real max_dist)
 {
   ResidueViewList ref_residues=ref.GetResidueList();
+  if (!mdl.GetResidueCount()) {
+	LOG_WARNING("model structures doesn't contain any residues");
+	return 0.0;	
+  }
+  if (ref_residues.empty()) {
+	LOG_WARNING("reference structures doesn't contain any residues");
+	return 0.0;	
+  }
   ChainView mdl_chain=mdl.GetChainList()[0];  
   // Residues with symmetric side-chains require special treatment as there are 
   // two possible ways to name the atoms. We calculate the overlap with the 
-- 
GitLab