Skip to content

Commit 58a05be

Browse files
committed
Fix segfault with blast6out and output_no_hits options
1 parent 09bd101 commit 58a05be

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

src/results.cc

+22-20
Original file line numberDiff line numberDiff line change
@@ -194,29 +194,31 @@ void results_show_blast6out_one(FILE * fp,
194194
but only 12 when there is a hit. Fixed in VSEARCH.
195195
*/
196196

197-
if (not hp)
197+
if (hp)
198+
{
199+
// if 'hp->strand' then 'minus strand' else 'plus strand'
200+
const int qstart = hp->strand ? qseqlen : 1;
201+
const int qend = hp->strand ? 1 : qseqlen;
202+
203+
fprintf(fp,
204+
"%s\t%s\t%.1f\t%d\t%d\t%d\t%d\t%d\t%d\t%" PRIu64 "\t%d\t%d\n",
205+
query_head,
206+
db_getheader(hp->target),
207+
hp->id,
208+
hp->internal_alignmentlength,
209+
hp->mismatches,
210+
hp->internal_gaps,
211+
qstart,
212+
qend,
213+
1,
214+
db_getsequencelen(hp->target),
215+
-1,
216+
0);
217+
}
218+
else
198219
{
199220
fprintf(fp, "%s\t*\t0.0\t0\t0\t0\t0\t0\t0\t0\t-1\t0\n", query_head);
200221
}
201-
202-
// if 'hp->strand' then 'minus strand' else 'plus strand'
203-
const int qstart = hp->strand ? qseqlen : 1;
204-
const int qend = hp->strand ? 1 : qseqlen;
205-
206-
fprintf(fp,
207-
"%s\t%s\t%.1f\t%d\t%d\t%d\t%d\t%d\t%d\t%" PRIu64 "\t%d\t%d\n",
208-
query_head,
209-
db_getheader(hp->target),
210-
hp->id,
211-
hp->internal_alignmentlength,
212-
hp->mismatches,
213-
hp->internal_gaps,
214-
qstart,
215-
qend,
216-
1,
217-
db_getsequencelen(hp->target),
218-
-1,
219-
0);
220222
}
221223

222224
void results_show_uc_one(FILE * fp,

0 commit comments

Comments
 (0)