summaryrefslogtreecommitdiff
path: root/libraries/OBD/OBD.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/OBD/OBD.cpp')
-rw-r--r--libraries/OBD/OBD.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/OBD/OBD.cpp b/libraries/OBD/OBD.cpp
index 3dba269..cd5290e 100644
--- a/libraries/OBD/OBD.cpp
+++ b/libraries/OBD/OBD.cpp
@@ -225,14 +225,14 @@ byte COBD::receive(char* buffer, int timeout)
unsigned char n = 0;
bool prompted = false;
- buffer[0] = 0;
+ if (buffer) buffer[0] = 0;
for (;;) {
if (available()) {
char c = read();
if (n > 2 && c == '>') {
// prompt char received
prompted = true;
- } else if (n < OBD_RECV_BUF_SIZE - 1) {
+ } else if (n < OBD_RECV_BUF_SIZE - 1 && buffer) {
buffer[n++] = c;
if (c == '.') {
n = 0;