Fossil SCM

Fix the "foci" virtual table so that it is able to correctly handle non-existant manifest numbers.

drh 2015-07-15 21:47 trunk
Commit 31c3c599ffb1b449c980a3d54c1811fa57e34f28
1 file changed +5 -4
+5 -4
--- src/foci.c
+++ src/foci.c
@@ -167,17 +167,18 @@
167167
){
168168
FociCursor *pCur = (FociCursor *)pCursor;
169169
manifest_destroy(pCur->pMan);
170170
if( idxNum ){
171171
pCur->pMan = manifest_get(sqlite3_value_int(argv[0]), CFTYPE_MANIFEST, 0);
172
- pCur->iFile = 0;
173
- manifest_file_rewind(pCur->pMan);
174
- pCur->pFile = manifest_file_next(pCur->pMan, 0);
172
+ if( pCur->pMan ){
173
+ manifest_file_rewind(pCur->pMan);
174
+ pCur->pFile = manifest_file_next(pCur->pMan, 0);
175
+ }
175176
}else{
176177
pCur->pMan = 0;
177
- pCur->iFile = 0;
178178
}
179
+ pCur->iFile = 0;
179180
return SQLITE_OK;
180181
}
181182
182183
static int fociColumn(
183184
sqlite3_vtab_cursor *pCursor,
184185
--- src/foci.c
+++ src/foci.c
@@ -167,17 +167,18 @@
167 ){
168 FociCursor *pCur = (FociCursor *)pCursor;
169 manifest_destroy(pCur->pMan);
170 if( idxNum ){
171 pCur->pMan = manifest_get(sqlite3_value_int(argv[0]), CFTYPE_MANIFEST, 0);
172 pCur->iFile = 0;
173 manifest_file_rewind(pCur->pMan);
174 pCur->pFile = manifest_file_next(pCur->pMan, 0);
 
175 }else{
176 pCur->pMan = 0;
177 pCur->iFile = 0;
178 }
 
179 return SQLITE_OK;
180 }
181
182 static int fociColumn(
183 sqlite3_vtab_cursor *pCursor,
184
--- src/foci.c
+++ src/foci.c
@@ -167,17 +167,18 @@
167 ){
168 FociCursor *pCur = (FociCursor *)pCursor;
169 manifest_destroy(pCur->pMan);
170 if( idxNum ){
171 pCur->pMan = manifest_get(sqlite3_value_int(argv[0]), CFTYPE_MANIFEST, 0);
172 if( pCur->pMan ){
173 manifest_file_rewind(pCur->pMan);
174 pCur->pFile = manifest_file_next(pCur->pMan, 0);
175 }
176 }else{
177 pCur->pMan = 0;
 
178 }
179 pCur->iFile = 0;
180 return SQLITE_OK;
181 }
182
183 static int fociColumn(
184 sqlite3_vtab_cursor *pCursor,
185

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button