1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-26 15:12:21 +01:00

fix: improve token extraction in split_to_int_vector_ for better clarity and correctness

This commit is contained in:
Oliver Kleinecke
2025-02-19 11:14:16 +01:00
parent 00f88fa3f8
commit 6fb093aa1d

View File

@@ -342,7 +342,8 @@ std::vector<uint8_t> DynamicLampComponent::split_to_int_vector_(const std::strin
size_t pos = 0; size_t pos = 0;
std::string token; std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) { while ((pos = s.find(delimiter)) != std::string::npos) {
token = static_cast<uint8_t>(atoi(s.substr(0, pos).c_str())); c_substr = s.substr(0, pos).c_str();
token = static_cast<uint8_t>(atoi(c_substr));
tokens.push_back(token); tokens.push_back(token);
s.erase(0, pos + delimiter.length()); s.erase(0, pos + delimiter.length());
} }