Skip to content

Commit ff541e5

Browse files
committed
Fix NPE and refrence to fundtion im lambda
1 parent 52c7722 commit ff541e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Entry.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ char *Entry::getValue() {
166166
}
167167

168168
bool Entry::setValue(const char *value, bool force) {
169-
if(force || strcmp(value, lastValue) != 0) {
169+
if(force || !lastValue || strcmp(value, lastValue) != 0) {
170170
lastUpdate = millis();
171171
if(lastValue) {
172172
free(lastValue);
@@ -225,13 +225,13 @@ void Entry::operator<<(std::function<String()> inFunction) {
225225
}
226226

227227
void Entry::operator<<(std::function<char *()> inFunction) {
228-
Entry::inFunction = [&]() {
228+
Entry::inFunction = [&, inFunction]() {
229229
return String(inFunction());
230230
};
231231
}
232232

233233
void Entry::operator<<(std::function<float()> inFunction) {
234-
Entry::inFunction = [&]() {
234+
Entry::inFunction = [&, inFunction]() {
235235
float value = inFunction();
236236
if(isnan(value)) {
237237
return String("");

0 commit comments

Comments
 (0)