Skip to content

Commit

Permalink
Fix time format check.
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana-yan committed Jan 20, 2021
1 parent c3804b0 commit cc3d82a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/just_gtfs/just_gtfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ inline Time::Time(const std::string & raw_time_str) : raw_time(raw_time_str)
return;

const size_t len = raw_time.size();
if (!(len >= 7 && len <= 9) || (raw_time[len - 3] != ':' && raw_time[len - 6] != ':'))
if (!(len >= 7 && len <= 9) || raw_time[len - 3] != ':' || raw_time[len - 6] != ':')
throw InvalidFieldFormat("Time is not in [[H]H]H:MM:SS format: " + raw_time_str);

hh = static_cast<uint16_t>(std::stoi(raw_time.substr(0, len - 6)));
Expand Down

0 comments on commit cc3d82a

Please sign in to comment.