@@ -60,8 +60,12 @@ macro_rules! make_index_binder {
6060 // For some reason detected as unused, which is not true
6161 #[ allow( unused_imports) ]
6262 use crate :: value:: CassCqlValue :: * ;
63+ let Some ( this) = BoxFFI :: as_mut_ref( this) else {
64+ tracing:: error!( "Provided null pointer to {}!" , stringify!( $fn_by_idx) ) ;
65+ return CassError :: CASS_ERROR_LIB_BAD_PARAMS ;
66+ } ;
6367 match ( $e) ( $( $arg) , * ) {
64- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , index as usize , v) ,
68+ Ok ( v) => $consume_v( this, index as usize , v) ,
6569 Err ( e) => e,
6670 }
6771 }
@@ -80,9 +84,13 @@ macro_rules! make_name_binder {
8084 // For some reason detected as unused, which is not true
8185 #[ allow( unused_imports) ]
8286 use crate :: value:: CassCqlValue :: * ;
87+ let Some ( this) = BoxFFI :: as_mut_ref( this) else {
88+ tracing:: error!( "Provided null pointer to {}!" , stringify!( $fn_by_name) ) ;
89+ return CassError :: CASS_ERROR_LIB_BAD_PARAMS ;
90+ } ;
8391 let name = unsafe { ptr_to_cstr( name) } . unwrap( ) ;
8492 match ( $e) ( $( $arg) , * ) {
85- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , name, v) ,
93+ Ok ( v) => $consume_v( this, name, v) ,
8694 Err ( e) => e,
8795 }
8896 }
@@ -102,9 +110,13 @@ macro_rules! make_name_n_binder {
102110 // For some reason detected as unused, which is not true
103111 #[ allow( unused_imports) ]
104112 use crate :: value:: CassCqlValue :: * ;
113+ let Some ( this) = BoxFFI :: as_mut_ref( this) else {
114+ tracing:: error!( "Provided null pointer to {}!" , stringify!( $fn_by_name_n) ) ;
115+ return CassError :: CASS_ERROR_LIB_BAD_PARAMS ;
116+ } ;
105117 let name = unsafe { ptr_to_cstr_n( name, name_length) } . unwrap( ) ;
106118 match ( $e) ( $( $arg) , * ) {
107- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , name, v) ,
119+ Ok ( v) => $consume_v( this, name, v) ,
108120 Err ( e) => e,
109121 }
110122 }
@@ -122,8 +134,12 @@ macro_rules! make_appender {
122134 // For some reason detected as unused, which is not true
123135 #[ allow( unused_imports) ]
124136 use crate :: value:: CassCqlValue :: * ;
137+ let Some ( this) = BoxFFI :: as_mut_ref( this) else {
138+ tracing:: error!( "Provided null pointer to {}!" , stringify!( $fn_append) ) ;
139+ return CassError :: CASS_ERROR_LIB_BAD_PARAMS ;
140+ } ;
125141 match ( $e) ( $( $arg) , * ) {
126- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , v) ,
142+ Ok ( v) => $consume_v( this, v) ,
127143 Err ( e) => e,
128144 }
129145 }
0 commit comments