when loading daystart/dayend, replace missing, corrupt, or impossible values with...
authorArt Cancro <ajc@citadel.org>
Thu, 21 Aug 2008 01:40:25 +0000 (01:40 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 21 Aug 2008 01:40:25 +0000 (01:40 +0000)
webcit/calendar_view.c

index f4de52a960e7b306663295b9e25d0bc4d199d8a4..f5f440baf0fdec0b92ebc05ef6978112f86441d8 100644 (file)
@@ -1058,6 +1058,12 @@ void calendar_day_view(int year, int month, int day) {
        time_format = get_time_format_cached ();
        get_pref_long("daystart", &daystart, 8);
        get_pref_long("dayend", &dayend, 17);
+
+       /* when loading daystart/dayend, replace missing, corrupt, or impossible values with defaults */
+       if ((daystart < 0) || (dayend < 2) || (daystart >= 23) || (dayend > 23) || (dayend <= daystart)) {
+               daystart = 9;
+               dayend = 17;
+       }
        
        /* Today's date */
        memset(&d_tm, 0, sizeof d_tm);