Fix appointment becoming event

You try to enter an appointment, but enter an invalid start time (by
mistake). Calcurse rejects the input. You enter the correct start time
and calcurse asks for the description, not the end time, i.e. you get an
event.

The check for an event must only be performed on valid input.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2018-06-04 17:01:01 +02:00 committed by Lukas Fleischer
parent 500b0c080e
commit 40eb6f809e

View File

@ -534,11 +534,11 @@ void ui_day_item_add(void)
is_appointment = 0;
break;
}
ret = parse_datetime(item_time, &start);
if (!(ret & PARSE_DATETIME_HAS_TIME))
is_appointment = 0;
if (ret)
if ((ret = parse_datetime(item_time, &start))) {
if (!(ret & PARSE_DATETIME_HAS_TIME))
is_appointment = 0;
break;
}
status_mesg(format_message_1, enter_str);
keys_wait_for_any_key(win[KEY].p);
}