Skip to content

Commit 684c3e8

Browse files
ABOSTMfpistm
authored andcommitted
Wire: rxBuffer should be initialized before using it
rxBuffer is used within resetRxBuffer(); Idem for txBuffer
1 parent 9f1227f commit 684c3e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libraries/Wire/src/Wire.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ void TwoWire::begin(uint8_t address, bool generalCall)
5959
{
6060
rxBufferIndex = 0;
6161
rxBufferLength = 0;
62+
rxBuffer = nullptr;
63+
rxBufferAllocated = 0;
6264
resetRxBuffer();
6365

6466
txBufferIndex = 0;
6567
txBufferLength = 0;
66-
resetTxBuffer();
67-
68-
rxBuffer = nullptr;
69-
rxBufferAllocated = 0;
7068
txAddress = 0;
7169
txBuffer = nullptr;
7270
txBufferAllocated = 0;
71+
resetTxBuffer();
72+
7373
_i2c.__this = (void *)this;
7474
user_onRequest = NULL;
7575
transmitting = 0;

0 commit comments

Comments
 (0)