Changeset 3359


Ignore:
Timestamp:
Nov 23, 2014, 1:05:13 PM (8 years ago)
Author:
Peter
Message:

fix issues in OutBamFile::write. refs #794

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/bam.cc

    r3306 r3359  
    8383  bam.cigar(cig);
    8484  suite.out() << bam.cigar_str() << "\n";
    85   suite.add(bam.cigar_str()=="");
     85  if (!suite.add(bam.cigar_str()==""))
     86    suite.err() << "error: expected cigar to be empty\n";
    8687  os.write(bam);
    8788
  • trunk/yat/omic/BamFile.cc

    r3358 r3359  
    200200  {
    201201#if YAT_HAVE_HTSLIB
    202     if (bam_write1(sf_->fp.bgzf, read.bam_)<=0) {
    203 #else
    204     if (samwrite(sf_, read.bam_)<=0) {
    205 #endif
    206       throw OutBamFile::error(read);
    207     }
     202    assert(read.bam_);
     203    if (is_open() && bam_write1(sf_->fp.bgzf, read.bam_)>0)
     204      return;
     205#else
     206    if (samwrite(sf_, read.bam_)>0)
     207      return;
     208#endif
     209    throw OutBamFile::error(read);
    208210  }
    209211
Note: See TracChangeset for help on using the changeset viewer.