File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ ICACHE_FLASH_ATTR String::~String() {
121
121
if (buffer) {
122
122
free (buffer);
123
123
}
124
+ init ();
124
125
}
125
126
126
127
// /*********************************************/
@@ -136,8 +137,7 @@ inline void String::init(void) {
136
137
void ICACHE_FLASH_ATTR String::invalidate (void ) {
137
138
if (buffer)
138
139
free (buffer);
139
- buffer = NULL ;
140
- capacity = len = 0 ;
140
+ init ();
141
141
}
142
142
143
143
unsigned char ICACHE_FLASH_ATTR String::reserve (unsigned int size) {
Original file line number Diff line number Diff line change @@ -76,7 +76,11 @@ class String {
76
76
// invalid string (i.e., "if (s)" will be true afterwards)
77
77
unsigned char reserve (unsigned int size);
78
78
inline unsigned int length (void ) const {
79
- return len;
79
+ if (buffer) {
80
+ return len;
81
+ } else {
82
+ return 0 ;
83
+ }
80
84
}
81
85
82
86
// creates a copy of the assigned value. if the value is null or
You can’t perform that action at this time.
0 commit comments