From f2263e62bfd1e17aebee4d5f802528a18a89ef90 Mon Sep 17 00:00:00 2001 From: oarcher Date: Wed, 28 Aug 2024 21:02:52 +0200 Subject: [PATCH] fix empty gnss --- esphome/components/modem/sensor/modem_sensor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/modem/sensor/modem_sensor.cpp b/esphome/components/modem/sensor/modem_sensor.cpp index 14d9b190a5..d72a5cd1c9 100644 --- a/esphome/components/modem/sensor/modem_sensor.cpp +++ b/esphome/components/modem/sensor/modem_sensor.cpp @@ -64,15 +64,15 @@ std::map get_gnssinfo_tokens(const std::string &gnss_i // for 7600 (16 tokens): // +CGNSSINFO: 2,04,03,00,4836.989133,N,00433.611595,W,060824,102247.0,-13.8,0.0,70.4,1.7,1.4,1.0 - std::string data = gnss_info.substr(12); - std::map gnss_data; - if (data.find(",,,,,,") != std::string::npos) { + if (gnss_info.find(",,,,,,") != std::string::npos) { ESP_LOGW(TAG, "No GNSS location available"); return gnss_data; // empty } + std::string data = gnss_info.substr(12); + std::vector parts; char delimiter = ','; std::istringstream token_stream(data);