aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/e-misc-utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c
index 0f350999f5..776027da09 100644
--- a/e-util/e-misc-utils.c
+++ b/e-util/e-misc-utils.c
@@ -1596,6 +1596,10 @@ GDateWeekday
e_weekday_add_days (GDateWeekday weekday,
guint n_days)
{
+ g_return_val_if_fail (
+ g_date_valid_weekday (weekday),
+ G_DATE_BAD_WEEKDAY);
+
n_days %= 7; /* Weekdays repeat every 7 days. */
while (n_days-- > 0)
@@ -1617,6 +1621,10 @@ GDateWeekday
e_weekday_subtract_days (GDateWeekday weekday,
guint n_days)
{
+ g_return_val_if_fail (
+ g_date_valid_weekday (weekday),
+ G_DATE_BAD_WEEKDAY);
+
n_days %= 7; /* Weekdays repeat every 7 days. */
while (n_days-- > 0)
@@ -1640,6 +1648,9 @@ e_weekday_get_days_between (GDateWeekday weekday1,
{
guint n_days = 0;
+ g_return_val_if_fail (g_date_valid_weekday (weekday1), 0);
+ g_return_val_if_fail (g_date_valid_weekday (weekday2), 0);
+
while (weekday1 != weekday2) {
n_days++;
weekday1 = e_weekday_get_next (weekday1);