From bff9f0b6b1241af66ec8bbc02367bfe55ca5d239 Mon Sep 17 00:00:00 2001 From: Jeroen88 Date: Thu, 6 Dec 2018 19:01:06 +0100 Subject: [PATCH] Fix error in PR #2048: if ::available() is called before ::connect() _rxBuffer is not initialised (#2155) --- libraries/WiFi/src/WiFiClient.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 6669ef59..5c42cc9d 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -398,6 +398,10 @@ int WiFiClient::peek() int WiFiClient::available() { + if(!_rxBuffer) + { + return 0; + } int res = _rxBuffer->available(); if(_rxBuffer->failed()) { log_e("%d", errno);