Fix ESP8266 preference loading (#2367)

This commit is contained in:
Paul Monigatti 2021-09-22 13:55:49 +12:00 committed by GitHub
parent bbac1534a3
commit c8a8acd46e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,7 +149,12 @@ class ESP8266PreferenceBackend : public ESPPreferenceBackend {
return false; return false;
uint32_t crc = calculate_crc(buffer.begin(), buffer.end() - 1, type); uint32_t crc = calculate_crc(buffer.begin(), buffer.end() - 1, type);
return buffer[buffer.size() - 1] == crc; if (buffer[buffer.size() - 1] != crc) {
return false;
}
memcpy(data, buffer.data(), len);
return true;
} }
}; };