File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ where
105
105
/// The buffer must have a length of at most 255 bytes on the nRF52832
106
106
/// and at most 65535 bytes on the nRF52840.
107
107
pub fn write ( & mut self , tx_buffer : & [ u8 ] ) -> Result < ( ) , Error > {
108
+ if tx_buffer. len ( ) == 0 {
109
+ return Err ( Error :: TxBufferTooSmall ) ;
110
+ }
111
+
108
112
if tx_buffer. len ( ) > EASY_DMA_SIZE {
109
113
return Err ( Error :: TxBufferTooLong ) ;
110
114
}
@@ -327,6 +331,10 @@ fn stop_write(uarte: &uarte0::RegisterBlock) {
327
331
/// Start a UARTE read transaction by setting the control
328
332
/// values and triggering a read task.
329
333
fn start_read ( uarte : & uarte0:: RegisterBlock , rx_buffer : & mut [ u8 ] ) -> Result < ( ) , Error > {
334
+ if rx_buffer. len ( ) == 0 {
335
+ return Err ( Error :: RxBufferTooSmall ) ;
336
+ }
337
+
330
338
if rx_buffer. len ( ) > EASY_DMA_SIZE {
331
339
return Err ( Error :: RxBufferTooLong ) ;
332
340
}
You can’t perform that action at this time.
0 commit comments