commit 870050b4a291b5ad0e6991fbaf558dd440c8337f
parent fff175f97b8e8f240fc185bccf476171cddc2116
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sat, 22 Jun 2024 10:57:42 +0200
feat: err for empty xml response
Diffstat:
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/caldav.c b/src/caldav.c
@@ -623,9 +623,9 @@ void put_event(struct tm* date, const char* dir, size_t dir_size, char* calendar
strftime(uid, sizeof uid, "%Y%m%d", date);
char* ics = "BEGIN:VCALENDAR\n"
- "PRODID:-//diary\n" // todo: add version
- "VERSION:2.0\n"
- "CALSCALE:GREGORIAN\n"
+ "PRODID:-//diary\n" // todo: add version
+ "VERSION:2.0\n"
+ "CALSCALE:GREGORIAN\n"
"BEGIN:VEVENT\n"
"UID:%s\n"
"DTSTART;VALUE=DATE:%s\n"
@@ -782,6 +782,23 @@ int caldav_sync(struct tm* date,
char* home_set = caldav_req(date, uri, "PROPFIND", homeset_request, 0, basicauth_enabled, "application/xml", 0);
tracepoint(diary, debug_string, "Home set xml", home_set);
+ if (home_set == NULL) {
+ pthread_cancel(progress_tid);
+ wclear(header);
+ wresize(header, LINES, getmaxx(header));
+ info_txt = "Error while fetching home set in caldav_sync()\n"
+ "Press any key to continue.";
+ mvwaddstr(header, 0, 0, info_txt);
+ wrefresh(header);
+
+ // accept any input to proceed
+ noecho();
+ wgetch(header);
+ echo();
+
+ wclear(header);
+ return -1;
+ }
// parse home set from xml response
char* home_set_parsed = parse_home_set(home_set);