@@ -60,8 +60,12 @@ macro_rules! make_index_binder {
60
60
// For some reason detected as unused, which is not true
61
61
#[ allow( unused_imports) ]
62
62
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
+ } ;
63
67
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) ,
65
69
Err ( e) => e,
66
70
}
67
71
}
@@ -80,9 +84,13 @@ macro_rules! make_name_binder {
80
84
// For some reason detected as unused, which is not true
81
85
#[ allow( unused_imports) ]
82
86
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
+ } ;
83
91
let name = unsafe { ptr_to_cstr( name) } . unwrap( ) ;
84
92
match ( $e) ( $( $arg) , * ) {
85
- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , name, v) ,
93
+ Ok ( v) => $consume_v( this, name, v) ,
86
94
Err ( e) => e,
87
95
}
88
96
}
@@ -102,9 +110,13 @@ macro_rules! make_name_n_binder {
102
110
// For some reason detected as unused, which is not true
103
111
#[ allow( unused_imports) ]
104
112
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
+ } ;
105
117
let name = unsafe { ptr_to_cstr_n( name, name_length) } . unwrap( ) ;
106
118
match ( $e) ( $( $arg) , * ) {
107
- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , name, v) ,
119
+ Ok ( v) => $consume_v( this, name, v) ,
108
120
Err ( e) => e,
109
121
}
110
122
}
@@ -122,8 +134,12 @@ macro_rules! make_appender {
122
134
// For some reason detected as unused, which is not true
123
135
#[ allow( unused_imports) ]
124
136
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
+ } ;
125
141
match ( $e) ( $( $arg) , * ) {
126
- Ok ( v) => $consume_v( BoxFFI :: as_mut_ref ( this) . unwrap ( ) , v) ,
142
+ Ok ( v) => $consume_v( this, v) ,
127
143
Err ( e) => e,
128
144
}
129
145
}
0 commit comments