summaryrefslogtreecommitdiff
path: root/ext/odbc/php_odbc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r--ext/odbc/php_odbc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index bf5a613f7f..dac5901b8c 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -1631,6 +1631,11 @@ PHP_FUNCTION(odbc_result)
/* get field index if the field parameter was a string */
if (field != NULL) {
+ if (result->values == NULL) {
+ php_error(E_WARNING, "Result set contains no data");
+ RETURN_FALSE;
+ }
+
for(i = 0; i < result->numcols; i++) {
if (!strcasecmp(result->values[i].name, field)) {
field_ind = i;