]> granicus.if.org Git - php/commitdiff
Fixing crash when result conrains 0 rows
authorFrank M. Kromann <fmk@php.net>
Tue, 20 Mar 2001 20:25:55 +0000 (20:25 +0000)
committerFrank M. Kromann <fmk@php.net>
Tue, 20 Mar 2001 20:25:55 +0000 (20:25 +0000)
ext/fbsql/php_fbsql.c

index 8caa1edc1e11e692f913a451eac43aa715d50cf5..6d3775c0d8eed1635886c5e34c12f1ee0087c7cf 100644 (file)
@@ -2555,6 +2555,9 @@ PHP_FUNCTION(fbsql_fetch_row)
        if (result->fetchHandle == NULL) {
                RETURN_FALSE;
        }
+       if (result->rowCount == 0) {
+               RETURN_FALSE;
+       }
        if (result->rowCount == 0x7fffffff) {
                if (!phpfbFetchRow(result,rowIndex)) {
                        RETURN_FALSE;
@@ -2627,9 +2630,14 @@ PHP_FUNCTION(fbsql_fetch_array)
        {
                RETURN_FALSE;
        }
+       if (result->rowCount == 0) {
+               RETURN_FALSE;
+       }
        if (result->rowCount == 0x7fffffff)
        {
-               phpfbFetchRow(result,result->rowIndex);
+               if (!phpfbFetchRow(result,result->rowIndex)) {
+                       RETURN_FALSE;
+               }
        }
        row = fbcrhRowAtIndex(result->rowHandler,rowIndex);
        if (row == NULL)