We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8e34664 commit b5c6021Copy full SHA for b5c6021
1 file changed
src/api.rs
@@ -117,9 +117,13 @@ pub fn mprintf(base: &str) -> Result<*mut c_char, MprintfError> {
117
/// Returns the [`sqlite3_value_blob`](https://www.sqlite.org/c3ref/value_blob.html) result
118
/// from the given sqlite3_value, as a u8 slice.
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) };
+ match value_bytes(value) {
+ 0 => &[],
+ n => {
123
+ let b = unsafe { sqlite3ext_value_blob(value.to_owned()) };
124
+ unsafe { from_raw_parts(b.cast::<u8>(), n as usize) }
125
+ }
126
127
}
128
129
/// Returns the [`sqlite3_value_bytes`](https://www.sqlite.org/c3ref/value_blob.html) result
0 commit comments