aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/ecpg.header
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/preproc/ecpg.header')
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.header3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header
index d3df8eabbb7..a415780faff 100644
--- a/src/interfaces/ecpg/preproc/ecpg.header
+++ b/src/interfaces/ecpg/preproc/ecpg.header
@@ -432,7 +432,8 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
/* This tests whether the cursor was declared and opened in the same function. */
#define SAMEFUNC(cur) \
((cur->function == NULL) || \
- (cur->function != NULL && strcmp(cur->function, current_function) == 0))
+ (cur->function != NULL && current_function != NULL && \
+ strcmp(cur->function, current_function) == 0))
static struct cursor *
add_additional_variables(const char *name, bool insert)