Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ublox_gps/include/ublox_gps/callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#ifndef UBLOX_GPS_CALLBACK_HPP
#define UBLOX_GPS_CALLBACK_HPP

#include <algorithm>
#include <chrono>
#include <condition_variable>
#include <functional>
Expand Down Expand Up @@ -203,6 +204,9 @@ class CallbackHandlers final {
size_t nmea_end = buffer.find('\n', nmea_start);
while(nmea_start != std::string::npos && nmea_end != std::string::npos) {
std::string sentence = buffer.substr(nmea_start, nmea_end - nmea_start + 1);
// Strip null characters that may be present in binary data misidentified
// as NMEA. FastCDR >= 2.2.7 throws BadParamException on strings with nulls.
sentence.erase(std::remove(sentence.begin(), sentence.end(), '\0'), sentence.end());
callback_nmea_(sentence);

nmea_start = buffer.find('$', nmea_end + 1);
Expand Down