Skip to content

Commit

Permalink
Fix segfault with blast6out and output_no_hits options
Browse files Browse the repository at this point in the history
  • Loading branch information
torognes committed Apr 26, 2024
1 parent 09bd101 commit 58a05be
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/results.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,29 +194,31 @@ void results_show_blast6out_one(FILE * fp,
but only 12 when there is a hit. Fixed in VSEARCH.
*/

if (not hp)
if (hp)
{
// if 'hp->strand' then 'minus strand' else 'plus strand'
const int qstart = hp->strand ? qseqlen : 1;
const int qend = hp->strand ? 1 : qseqlen;

fprintf(fp,
"%s\t%s\t%.1f\t%d\t%d\t%d\t%d\t%d\t%d\t%" PRIu64 "\t%d\t%d\n",
query_head,
db_getheader(hp->target),
hp->id,
hp->internal_alignmentlength,
hp->mismatches,
hp->internal_gaps,
qstart,
qend,
1,
db_getsequencelen(hp->target),
-1,
0);
}
else
{
fprintf(fp, "%s\t*\t0.0\t0\t0\t0\t0\t0\t0\t0\t-1\t0\n", query_head);
}

// if 'hp->strand' then 'minus strand' else 'plus strand'
const int qstart = hp->strand ? qseqlen : 1;
const int qend = hp->strand ? 1 : qseqlen;

fprintf(fp,
"%s\t%s\t%.1f\t%d\t%d\t%d\t%d\t%d\t%d\t%" PRIu64 "\t%d\t%d\n",
query_head,
db_getheader(hp->target),
hp->id,
hp->internal_alignmentlength,
hp->mismatches,
hp->internal_gaps,
qstart,
qend,
1,
db_getsequencelen(hp->target),
-1,
0);
}

void results_show_uc_one(FILE * fp,
Expand Down

0 comments on commit 58a05be

Please sign in to comment.