Fixed error handling when opening frquencies files.
Let `compute_trace()` return `NULL` and set `nsat` to zero if data files cannot be opened. Otherwise the caller would receive undefined values.pull/16/head
parent
f39ded98f7
commit
e6beaae22c
|
@ -512,7 +512,8 @@ struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float fr
|
|||
infile=fopen(freqlist,"r");
|
||||
if (infile==NULL) {
|
||||
printf("%s not found\n",freqlist);
|
||||
return t;
|
||||
*nsat=0;
|
||||
return NULL;
|
||||
} else {
|
||||
for (i=0;;) {
|
||||
if (fgetline(infile,line,LIM)<=0)
|
||||
|
@ -530,7 +531,10 @@ struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float fr
|
|||
}
|
||||
// Break out
|
||||
if (i==0)
|
||||
return t;
|
||||
{
|
||||
*nsat=0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Valid MJDs
|
||||
for (i=0;i<n;i++)
|
||||
|
|
Loading…
Reference in New Issue