Fossil SCM
Fix the "foci" virtual table so that it is able to correctly handle non-existant manifest numbers.
Commit
31c3c599ffb1b449c980a3d54c1811fa57e34f28
Parent
fd302a26118849d…
1 file changed
+5
-4
+5
-4
| --- src/foci.c | ||
| +++ src/foci.c | ||
| @@ -167,17 +167,18 @@ | ||
| 167 | 167 | ){ |
| 168 | 168 | FociCursor *pCur = (FociCursor *)pCursor; |
| 169 | 169 | manifest_destroy(pCur->pMan); |
| 170 | 170 | if( idxNum ){ |
| 171 | 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); | |
| 172 | + if( pCur->pMan ){ | |
| 173 | + manifest_file_rewind(pCur->pMan); | |
| 174 | + pCur->pFile = manifest_file_next(pCur->pMan, 0); | |
| 175 | + } | |
| 175 | 176 | }else{ |
| 176 | 177 | pCur->pMan = 0; |
| 177 | - pCur->iFile = 0; | |
| 178 | 178 | } |
| 179 | + pCur->iFile = 0; | |
| 179 | 180 | return SQLITE_OK; |
| 180 | 181 | } |
| 181 | 182 | |
| 182 | 183 | static int fociColumn( |
| 183 | 184 | sqlite3_vtab_cursor *pCursor, |
| 184 | 185 |
| --- 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 |