aboutsummaryrefslogtreecommitdiff
path: root/src/engine-eds.cpp
diff options
context:
space:
mode:
authorRatchanan Srirattanamet <ratchanan@ubports.com>2023-06-06 15:54:11 +0700
committerRobert Tari <robert@tari.in>2023-07-10 02:49:48 +0200
commitbfc2e3654b3eb4bd4d8fd336e489fe8840d7db9b (patch)
tree6e651dd8227fcdf6d99a8fafa42031edc4ae5752 /src/engine-eds.cpp
parent3e65062b5bb0957b5bb683ff04cb658d9d530477 (diff)
downloadayatana-indicator-datetime-bfc2e3654b3eb4bd4d8fd336e489fe8840d7db9b.tar.gz
ayatana-indicator-datetime-bfc2e3654b3eb4bd4d8fd336e489fe8840d7db9b.tar.bz2
ayatana-indicator-datetime-bfc2e3654b3eb4bd4d8fd336e489fe8840d7db9b.zip
engine-eds: fix retrieving custom alarm sound path
ECal 2.0 returns the list of attachments as a GSList (a singly linked list). I'm not sure why, but the logic for iterating the list is completely incorrect. Fixing that fixes custom alarm sound. A test is added to catch this case. Bug-UBports: https://gitlab.com/ubports/development/apps/lomiri-clock-app/-/issues/183
Diffstat (limited to 'src/engine-eds.cpp')
-rw-r--r--src/engine-eds.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp
index b7f4682..2748fc1 100644
--- a/src/engine-eds.cpp
+++ b/src/engine-eds.cpp
@@ -635,19 +635,18 @@ private:
auto action = e_cal_component_alarm_get_action(alarm);
if (action == E_CAL_COMPONENT_ALARM_AUDIO)
{
- ICalAttach *attach = nullptr;
auto attachments = e_cal_component_alarm_get_attachments(alarm);
- if (attachments != nullptr && attachments->next != nullptr)
- attach = I_CAL_ATTACH (attachments->data);
+ for (; attachments != nullptr; attachments = attachments->next) {
+ ICalAttach *attach = I_CAL_ATTACH (attachments->data);
- if (attach != nullptr)
- {
- if (i_cal_attach_get_is_url (attach))
+ if (attach != nullptr && i_cal_attach_get_is_url (attach))
{
const char* url = i_cal_attach_get_url(attach);
- if (url != nullptr)
+ if (url != nullptr) {
ret = url;
+ break;
+ }
}
}
if (ret.empty())