mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Check for NULL pointer in Print.write().
Otherwise, trying to print(NULL) or write(NULL) could print a random character. http://code.google.com/p/arduino/issues/detail?id=941
This commit is contained in:
parent
b3d724c33b
commit
b787982eec
@ -46,7 +46,10 @@ class Print
|
||||
void clearWriteError() { setWriteError(0); }
|
||||
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
|
||||
size_t write(const char *str) {
|
||||
if (str == NULL) return 0;
|
||||
return write((const uint8_t *)str, strlen(str));
|
||||
}
|
||||
virtual size_t write(const uint8_t *buffer, size_t size);
|
||||
|
||||
size_t print(const __FlashStringHelper *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user