From 7d5f277a9627a6171ae9d52ce7d236536213739e Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 7 Jun 2017 21:13:15 +0100 Subject: [PATCH] Fix not being able to enter 00:00 as a timetable start time. --- src/timetable_gui.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index bf4744f95f..6add2da1d1 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -668,8 +668,10 @@ struct TimetableWindow : Window { } case WID_VT_START_DATE: { - int32 val = StrEmpty(str) ? 0 : strtoul(str, NULL, 10); - if (val > 0) { + if (StrEmpty(str)) break; + char *end; + int32 val = strtol(str, &end, 10); + if (val >= 0 && end && *end == 0) { uint minutes = (val % 100) % 60; uint hours = (val / 100) % 24; val = MINUTES_DATE(MINUTES_DAY(CURRENT_MINUTE), hours, minutes);