Skip to content

Commit cf0e756

Browse files
Julian Regaladojkbonfield
Julian Regalado
authored andcommitted
BUGFIX header.c sam_hdr_remove_line_pos()
Parameter check on argument 'position' was not accounting for 0 based indeces as per header description: /* sam.h /// Remove nth line of a given type from a header /*! * @param type Type of the searched line. Eg. "SQ" * @param position Index in lines of this type (zero-based). E.g. 3 * @return 0 on success, -1 on error * * Remove a line from the header by specifying the position in the type * group, i.e. 3rd @sq line. */ HTSLIB_EXPORT int sam_hdr_remove_line_pos(sam_hdr_t *h, const char *type, int position); */
1 parent d43c5f6 commit cf0e756

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

header.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ int sam_hdr_remove_line_id(sam_hdr_t *bh, const char *type, const char *ID_key,
14501450

14511451
int sam_hdr_remove_line_pos(sam_hdr_t *bh, const char *type, int position) {
14521452
sam_hrecs_t *hrecs;
1453-
if (!bh || !type || position <= 0)
1453+
if (!bh || !type || position < 0)
14541454
return -1;
14551455

14561456
if (!(hrecs = bh->hrecs)) {

0 commit comments

Comments
 (0)