From 4b0d3b7147a3fa8f669870e0a740a2b0121a475c Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 6 Mar 2025 08:32:36 -0600 Subject: [PATCH] broadband-modem-qmi: use correct profile index in error message Instead of using the loop index, use the actual profile index because they aren't always the same. Signed-off-by: Dan Williams --- src/mm-broadband-modem-qmi.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index ee6310a9..16f2a088 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -6722,6 +6722,14 @@ modem_3gpp_profile_manager_list_profiles_finish (MMIfaceModem3gppProfileManager static void get_next_profile_settings (GTask *task); +static QmiMessageWdsGetProfileListOutputProfileListProfile * +get_current_qmi_profile_from_list (ListProfilesContext *ctx) +{ + return &g_array_index (ctx->qmi_profiles, + QmiMessageWdsGetProfileListOutputProfileListProfile, + ctx->i); +} + static void get_next_profile_settings_ready (MMIfaceModem3gppProfileManager *self, GAsyncResult *res, @@ -6735,7 +6743,12 @@ get_next_profile_settings_ready (MMIfaceModem3gppProfileManager *self, profile = modem_3gpp_profile_manager_get_profile_finish (self, res, &error); if (!profile) { - g_prefix_error (&error, "Couldn't load settings from profile index %u: ", ctx->i); + QmiMessageWdsGetProfileListOutputProfileListProfile *current; + + current = get_current_qmi_profile_from_list (ctx); + g_prefix_error (&error, + "Couldn't load settings from profile index %u: ", + current->profile_index); g_task_return_error (task, error); g_object_unref (task); return; @@ -6765,7 +6778,7 @@ get_next_profile_settings (GTask *task) return; } - current = &g_array_index (ctx->qmi_profiles, QmiMessageWdsGetProfileListOutputProfileListProfile, ctx->i); + current = get_current_qmi_profile_from_list (ctx); modem_3gpp_profile_manager_get_profile (MM_IFACE_MODEM_3GPP_PROFILE_MANAGER (self), current->profile_index, (GAsyncReadyCallback)get_next_profile_settings_ready,