From 4ddf77ec98132bd0eca00cd429934f21fec5feed Mon Sep 17 00:00:00 2001 From: Ivan Ukhov Date: Sat, 6 Oct 2018 10:30:41 +0200 Subject: [PATCH] Add a few assertions --- src/statement.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/statement.rs b/src/statement.rs index 9c72e30..64ae4f8 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -59,6 +59,7 @@ impl<'l> Statement<'l> { /// /// The type is revealed after the first step has been taken. pub fn kind(&self, i: usize) -> Type { + debug_assert!(i < self.count(), "the index is out of range"); match unsafe { ffi::sqlite3_column_type(self.raw.0, i as c_int) } { ffi::SQLITE_BLOB => Type::Binary, ffi::SQLITE_FLOAT => Type::Float, @@ -103,6 +104,7 @@ impl<'l> Statement<'l> { /// The leftmost column has the index 0. #[inline] pub fn read(&self, i: usize) -> Result { + debug_assert!(i < self.count(), "the index is out of range"); Readable::read(self, i) }