diff --git a/modules/io/src/mol/sdf_reader.cc b/modules/io/src/mol/sdf_reader.cc index 2db564c66de7d6c5990a9b78897d3420b5abfc12..ec84d1a01a0089d20adf96dc212511f3520504a0 100644 --- a/modules/io/src/mol/sdf_reader.cc +++ b/modules/io/src/mol/sdf_reader.cc @@ -253,9 +253,15 @@ void SDFReader::ParseAndAddBond(const String& line, int line_num, LOG_TRACE( "line: [" << line << "]" ); if(line.length()<9 || line.length()>21) { - String msg="Bad bond line %d: Not correct number of characters on the" - " line: %i (should be between 9 and 21)"; - throw IOException(str(format(msg) % line_num % line.length())); + // Handle the case where we have trailing space characters + if (line.length()>21 && boost::trim_copy(line.substr(21)) == "") { + LOG_ERROR( "Ignoring trailing space" ); + } + else { + String msg="Bad bond line %d: Not correct number of characters on the" + " line: %i (should be between 9 and 21)"; + throw IOException(str(format(msg) % line_num % line.length())); + } } String s_first_name=line.substr(0,3);