Skip to content

Commit

Permalink
gpssim: don't advertize uninitialized data
Browse files Browse the repository at this point in the history
According to valgrind uninitialized bytes were being advertized.
  • Loading branch information
julianoes authored and dagar committed Jun 7, 2019
1 parent 90bf26b commit d2c824c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/simulator/gpssim/gpssim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ GPSSIM::receive(int timeout)
{
Simulator *sim = Simulator::getInstance();
simulator::RawGPSData gps;
sim->getGPSSample((uint8_t *)&gps, sizeof(gps));

static uint64_t timestamp_last = 0;

if (gps.timestamp != timestamp_last) {
if (sim->getGPSSample((uint8_t *)&gps, sizeof(gps)) &&
(gps.timestamp != timestamp_last || timestamp_last == 0)) {
_report_gps_pos.timestamp = hrt_absolute_time();
_report_gps_pos.lat = gps.lat;
_report_gps_pos.lon = gps.lon;
Expand Down

0 comments on commit d2c824c

Please sign in to comment.