File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,13 @@ pub fn mprintf(base: &str) -> Result<*mut c_char, MprintfError> {
117
117
/// Returns the [`sqlite3_value_blob`](https://www.sqlite.org/c3ref/value_blob.html) result
118
118
/// from the given sqlite3_value, as a u8 slice.
119
119
pub fn value_blob < ' a > ( value : & * mut sqlite3_value ) -> & ' a [ u8 ] {
120
- let n = value_bytes ( value) ;
121
- let b = unsafe { sqlite3ext_value_blob ( value. to_owned ( ) ) } ;
122
- return unsafe { from_raw_parts ( b. cast :: < u8 > ( ) , n as usize ) } ;
120
+ match value_bytes ( value) {
121
+ 0 => & [ ] ,
122
+ n => {
123
+ let b = unsafe { sqlite3ext_value_blob ( value. to_owned ( ) ) } ;
124
+ unsafe { from_raw_parts ( b. cast :: < u8 > ( ) , n as usize ) }
125
+ }
126
+ }
123
127
}
124
128
125
129
/// Returns the [`sqlite3_value_bytes`](https://www.sqlite.org/c3ref/value_blob.html) result
You can’t perform that action at this time.
0 commit comments