Skip to content

Commit 7901f02

Browse files
committed
Attempt to execute even if an error status is set on entry
1 parent 392ecd2 commit 7901f02

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

datValid.c

+20-7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
* Description:
2727
* Enquire if a locator is valid, ie currently associated with an object.
2828
29+
* Notes:
30+
* This fuction attempts to execute even if an error status is set on entry.
31+
2932
* Authors:
3033
* TIMJ: Tim Jenness (Cornell)
3134
* {enter_new_authors_here}
@@ -81,17 +84,27 @@
8184
#include "hds1.h"
8285
#include "dat1.h"
8386
#include "hds.h"
87+
#include "ems.h"
8488

8589
int
8690
datValid(const HDSLoc *locator, hdsbool_t *valid, int *status) {
87-
*valid = 0;
88-
if (*status != SAI__OK) return *status;
8991

90-
if ( !locator ) return *status;
92+
/* Initialise the returned value */
93+
*valid = 0;
94+
95+
/* Check a locator was supplied. */
96+
if ( !locator ) return *status;
97+
98+
/* Begin a new error reporting context */
99+
emsBegin( status );
100+
101+
/* Check the validity of the locator */
102+
if (locator->group_id > 0 || locator->dataset_id > 0 ) {
103+
if( HANDLE_VALID(locator->handle) ) *valid = 1;
104+
}
91105

92-
if (locator->group_id > 0 || locator->dataset_id > 0 ) {
93-
if( HANDLE_VALID(locator->handle) ) *valid = 1;
94-
}
106+
/* End the current error reporting context */
107+
emsEnd( status );
95108

96-
return *status;
109+
return *status;
97110
}

0 commit comments

Comments
 (0)