From 15057e3a4a02f59a4080daff1650c9880d00b668 Mon Sep 17 00:00:00 2001 From: Adrian Soundy Date: Tue, 2 Jul 2019 09:15:29 +1200 Subject: [PATCH] Add sanity check for SPI dataBitLength --- .../win_dev_spi_native_Windows_Devices_Spi_SpiDevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Devices.Spi/win_dev_spi_native_Windows_Devices_Spi_SpiDevice.cpp b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Devices.Spi/win_dev_spi_native_Windows_Devices_Spi_SpiDevice.cpp index 8413b92afa..4bceb7904d 100644 --- a/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Devices.Spi/win_dev_spi_native_Windows_Devices_Spi_SpiDevice.cpp +++ b/targets/FreeRTOS_ESP32/ESP32_WROOM_32/nanoCLR/Windows.Devices.Spi/win_dev_spi_native_Windows_Devices_Spi_SpiDevice.cpp @@ -254,6 +254,7 @@ HRESULT Library_win_dev_spi_native_Windows_Devices_Spi_SpiDevice::NativeTransfer // get data bit length int databitLength = pConfig[ SpiConnectionSettings::FIELD___databitLength ].NumericByRef().s4; + if (databitLength <= 0) databitLength = 8; if ( data16 ) databitLength = 16; // dereference the write and read buffers from the arguments