diff --git a/src/history.h b/src/history.h index c322de3..656640b 100644 --- a/src/history.h +++ b/src/history.h @@ -41,6 +41,11 @@ class LocationHistoryProxy { BOOST_LOG_TRIVIAL(debug) << "Updating history"; auto ¤t_location = this->model->location; + if (not this->is_location_eligible_for_history(current_location)) { + BOOST_LOG_TRIVIAL(debug) << "Skipping history update for empty location"; + return; + } + auto &history = this->model->location_history; const auto found = std::find_if(history.begin(), history.end(), [current_location](const auto &item) { @@ -107,5 +112,11 @@ class LocationHistoryProxy { private: std::shared_ptr model; + + bool is_location_eligible_for_history(const Location &location) const { + return not (std::isnan(location.longitude) or + std::isnan(location.latitude) or + location.name.empty()); + } }; } // namespace taranis