From 9d299055e7558ec089ea3fd9f50d4fb3653fe643 Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Wed, 19 Aug 2015 21:02:29 +0200 Subject: [PATCH] Add asserts and whitespace fix --- src/bsonc.rs | 2 ++ src/collection.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bsonc.rs b/src/bsonc.rs index 8fd8800..591b296 100644 --- a/src/bsonc.rs +++ b/src/bsonc.rs @@ -96,10 +96,12 @@ impl Bsonc { } pub fn inner(&self) -> *const bindings::bson_t { + assert!(!self.inner.is_null()); self.inner } pub fn mut_inner(&mut self) -> *mut bindings::bson_t { + assert!(!self.inner.is_null()); self.inner as *mut bindings::bson_t } } diff --git a/src/collection.rs b/src/collection.rs index adbe158..f9b2d06 100644 --- a/src/collection.rs +++ b/src/collection.rs @@ -162,7 +162,7 @@ impl<'a> Collection<'a> { }, match options.read_prefs { Some(ref prefs) => prefs.inner(), - None => ptr::null() + None => ptr::null() }, error.mut_inner() )