Skip to content

Commit 9ae4fe8

Browse files
committed
Exit when no matching sample is found
1 parent 19bb932 commit 9ae4fe8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

consensus.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* The MIT License
22
3-
Copyright (c) 2014-2022 Genome Research Ltd.
3+
Copyright (c) 2014-2023 Genome Research Ltd.
44
55
Author: Petr Danecek <[email protected]>
66
@@ -231,9 +231,15 @@ static void init_data(args_t *args)
231231
if ( !args->sample )
232232
args->smpl = smpl_ilist_init(args->hdr,NULL,0,SMPL_NONE|SMPL_VERBOSE);
233233
else if ( args->sample && strcmp("-",args->sample) )
234+
{
234235
args->smpl = smpl_ilist_init(args->hdr,args->sample,0,SMPL_NONE|SMPL_VERBOSE);
236+
if ( args->smpl && !args->smpl->n ) error("No matching sample found\n");
237+
}
235238
else if ( args->sample_fname )
239+
{
236240
args->smpl = smpl_ilist_init(args->hdr,args->sample_fname,1,SMPL_NONE|SMPL_VERBOSE);
241+
if ( args->smpl && !args->smpl->n ) error("No matching sample found\n");
242+
}
237243
if ( args->smpl )
238244
{
239245
if ( args->haplotype || args->allele )

0 commit comments

Comments
 (0)