fix(modem): CEREG parsing fails due to incorrect state index

This commit is contained in:
Jelle van Kraaij
2025-10-27 16:31:57 +01:00
parent 2cc7c99664
commit a80a3cbb1e

View File

@@ -641,6 +641,8 @@ command_result get_network_registration_state(CommandableIf *t, int &state)
return command_result::FAIL;
}
state_pos_start += 1; // move past the comma
if (out.find(pattern) == std::string::npos || (state_pos_end = out.find(',', state_pos_start)) == std::string::npos) {
if (std::from_chars(out.data() + state_pos_start, out.data() + out.size(), state).ec == std::errc::invalid_argument) {
return command_result::FAIL;