Skip to content

Commit

Permalink
timeframe: guard against segfault following an error report
Browse files Browse the repository at this point in the history
  • Loading branch information
dsberry committed May 26, 2020
1 parent 55764ae commit 2e63de4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/timeframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -6187,11 +6187,13 @@ static int Unformat( AstFrame *this_frame, int axis, const char *string,
/* Attempt to read a date/time from the whol string. If this fails
terminate the string in order to make it one character shorter and try
again. */
for( lt = l; lt > 0; lt-- ) {
str[ lt ] = 0;
mjd = astReadDateTime( str );
if( !astOK ) astClearStatus;
if( mjd != AST__BAD ) break;
if( str ) {
for( lt = l; lt > 0; lt-- ) {
str[ lt ] = 0;
mjd = astReadDateTime( str );
if( !astOK ) astClearStatus;
if( mjd != AST__BAD ) break;
}
}

/* Re-instate error reporting. */
Expand Down

0 comments on commit 2e63de4

Please sign in to comment.