aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vdbeapi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 63c3254ed..1db9513bb 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -453,7 +453,7 @@ int sqlite3_data_count(sqlite3_stmt *pStmt){
static Mem *columnMem(sqlite3_stmt *pStmt, int i){
Vdbe *pVm = (Vdbe *)pStmt;
int vals = sqlite3_data_count(pStmt);
- if( i>=vals || i<0 ){
+ if( pVm==0 || pVm->resOnStack==0 || i>=pVm->nResColumn || i<0 ){
static const Mem nullMem = {{0}, 0.0, "", 0, MEM_Null, SQLITE_NULL };
sqlite3Error(pVm->db, SQLITE_RANGE, 0);
return (Mem*)&nullMem;