diff options
Diffstat (limited to 'cores')
-rw-r--r-- | cores/arduino/WString.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp index d5ea11f..fd07c2d 100644 --- a/cores/arduino/WString.cpp +++ b/cores/arduino/WString.cpp @@ -194,7 +194,11 @@ int String::operator>=( const String & rhs ) const char & String::operator[]( unsigned int index ) { - // need to check for valid index, to do later + static char dummy_writable_char; + if (index >= _length || !_buffer) { + dummy_writable_char = 0; + return dummy_writable_char; + } return _buffer[ index ]; } |