event: Trivial cleanup

We can avoid a lookup by simply checking if the alarm id
isn't NULL.
parent 4b6a5599
Pipeline #189292 passed with stages
in 6 minutes and 10 seconds
......@@ -1266,15 +1266,15 @@ void
gcal_event_remove_alarm (GcalEvent *self,
guint type)
{
const gchar *alarm_uid;
g_return_if_fail (GCAL_IS_EVENT (self));
alarm_uid = g_hash_table_lookup (self->alarms, GINT_TO_POINTER (type));
/* Only 1 alarm per relative time */
if (g_hash_table_contains (self->alarms, GINT_TO_POINTER (type)))
if (alarm_uid)
{
const gchar *alarm_uid;
alarm_uid = g_hash_table_lookup (self->alarms, GINT_TO_POINTER (type));
e_cal_component_remove_alarm (self->component, alarm_uid);
g_hash_table_remove (self->alarms, GINT_TO_POINTER (type));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment