]> git.donarmstrong.com Git - bamtools.git/commitdiff
This fixes the out-of-range exception. Though there's still a discrepancy with some...
authorDerek <derekwbarnett@gmail.com>
Mon, 7 Jun 2010 20:18:10 +0000 (16:18 -0400)
committerDerek <derekwbarnett@gmail.com>
Mon, 7 Jun 2010 20:18:10 +0000 (16:18 -0400)
bamtools_convert.cpp

index de86599288242a749e544d60abc5dd58ef8d92f0..e881d43c89a1d9dcff8685062902940b35a1f6b5 100644 (file)
@@ -288,6 +288,8 @@ void BamTools::PrintJSON(ostream& out, const BamAlignment& a) {
                     ++index; 
                     break;      
             }
+            
+            if ( tagData[index] == '\0') break;
         }
 
         out << "}";
@@ -348,9 +350,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
     size_t index = 0;
     while ( index < tagDataLength ) {
 
-        cerr << tagDataLength << " " << index << endl;
-        
-        // write tag name
+        // write tag name        
         out << "\t" << a.TagData.substr(index, 2) << ":";
         index += 2;
         
@@ -414,8 +414,9 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 ++index; 
                 break;      
         }
+        
+        if ( tagData[index] == '\0') break;
     }
 
     out << endl;
-    
 }