mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 18:53:55 +08:00
replay: fix potential timestamp parsing error in Route::load (#35117)
Fix potential timestamp parsing error in Route::load
This commit is contained in:
@@ -50,9 +50,11 @@ bool Route::load() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse the timestamp from the route identifier (only applicable for old route formats).
|
||||
struct tm tm_time = {0};
|
||||
strptime(route_.timestamp.c_str(), "%Y-%m-%d--%H-%M-%S", &tm_time);
|
||||
date_time_ = mktime(&tm_time);
|
||||
if (strptime(route_.timestamp.c_str(), "%Y-%m-%d--%H-%M-%S", &tm_time)) {
|
||||
date_time_ = mktime(&tm_time);
|
||||
}
|
||||
|
||||
bool ret = data_dir_.empty() ? loadFromServer() : loadFromLocal();
|
||||
if (ret) {
|
||||
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
RouteIdentifier route_ = {};
|
||||
std::string data_dir_;
|
||||
std::map<int, SegmentFile> segments_;
|
||||
std::time_t date_time_;
|
||||
std::time_t date_time_ = 0;
|
||||
RouteLoadError err_ = RouteLoadError::None;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user