From 80f39ff76cf4e0ab7beee9f93b81c90921c41b62 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Tue, 25 Feb 2020 14:49:16 +0100 Subject: [PATCH] Wire: rxBuffer should be initialized before using it rxBuffer is used within resetRxBuffer(); Idem for txBuffer --- libraries/Wire/src/Wire.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index a93367aa61..58b8d6913c 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -59,17 +59,17 @@ void TwoWire::begin(uint8_t address, bool generalCall) { rxBufferIndex = 0; rxBufferLength = 0; + rxBuffer = nullptr; + rxBufferAllocated = 0; resetRxBuffer(); txBufferIndex = 0; txBufferLength = 0; - resetTxBuffer(); - - rxBuffer = nullptr; - rxBufferAllocated = 0; txAddress = 0; txBuffer = nullptr; txBufferAllocated = 0; + resetTxBuffer(); + _i2c.__this = (void *)this; user_onRequest = NULL; transmitting = 0;