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 @@ -169,6 +169,10 @@ where
169169 /// The buffer must have a length of at most 255 bytes on the nRF52832
170170 /// and at most 65535 bytes on the nRF52840.
171171 pub fn write ( & mut self , tx_buffer : & [ u8 ] ) -> Result < ( ) , Error > {
172+ if tx_buffer. len ( ) == 0 {
173+ return Err ( Error :: TxBufferTooSmall ) ;
174+ }
175+
172176 if tx_buffer. len ( ) > EASY_DMA_SIZE {
173177 return Err ( Error :: TxBufferTooLong ) ;
174178 }
@@ -364,6 +368,10 @@ fn stop_write(uarte: &uarte0::RegisterBlock) {
364368/// Start a UARTE read transaction by setting the control
365369/// values and triggering a read task.
366370fn start_read ( uarte : & uarte0:: RegisterBlock , rx_buffer : & mut [ u8 ] ) -> Result < ( ) , Error > {
371+ if rx_buffer. len ( ) == 0 {
372+ return Err ( Error :: RxBufferTooSmall ) ;
373+ }
374+
367375 if rx_buffer. len ( ) > EASY_DMA_SIZE {
368376 return Err ( Error :: RxBufferTooLong ) ;
369377 }
You can’t perform that action at this time.
0 commit comments