Fossil SCM
Fix an assertion fault: detect when content_get() is called with an invalid artifact id and return 0.
Commit
4e2bd38577b2c83b7bc502d023a397172f2a1a66
Parent
76bd88c262cee72…
1 file changed
+1
+1
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -165,10 +165,11 @@ | ||
| 165 | 165 | int i; |
| 166 | 166 | static Bag inProcess; |
| 167 | 167 | |
| 168 | 168 | assert( g.repositoryOpen ); |
| 169 | 169 | blob_zero(pBlob); |
| 170 | + if( rid==0 ) return 0; | |
| 170 | 171 | |
| 171 | 172 | /* Early out if we know the content is not available */ |
| 172 | 173 | if( bag_find(&contentCache.missing, rid) ){ |
| 173 | 174 | CONTENT_TRACE(("%*smiss from cache: %d\n", |
| 174 | 175 | bag_count(&inProcess), "", rid)) |
| 175 | 176 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -165,10 +165,11 @@ | |
| 165 | int i; |
| 166 | static Bag inProcess; |
| 167 | |
| 168 | assert( g.repositoryOpen ); |
| 169 | blob_zero(pBlob); |
| 170 | |
| 171 | /* Early out if we know the content is not available */ |
| 172 | if( bag_find(&contentCache.missing, rid) ){ |
| 173 | CONTENT_TRACE(("%*smiss from cache: %d\n", |
| 174 | bag_count(&inProcess), "", rid)) |
| 175 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -165,10 +165,11 @@ | |
| 165 | int i; |
| 166 | static Bag inProcess; |
| 167 | |
| 168 | assert( g.repositoryOpen ); |
| 169 | blob_zero(pBlob); |
| 170 | if( rid==0 ) return 0; |
| 171 | |
| 172 | /* Early out if we know the content is not available */ |
| 173 | if( bag_find(&contentCache.missing, rid) ){ |
| 174 | CONTENT_TRACE(("%*smiss from cache: %d\n", |
| 175 | bag_count(&inProcess), "", rid)) |
| 176 |