From cea76b901569f8b0c384abe325db37fe445fd341 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 14 Nov 2019 14:26:46 +0100 Subject: trivial: Move a check earlier so that we exit the correct loop --- libappstream-glib/as-app-builder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libappstream-glib/as-app-builder.c b/libappstream-glib/as-app-builder.c index 16185ed..6ad0d9a 100644 --- a/libappstream-glib/as-app-builder.c +++ b/libappstream-glib/as-app-builder.c @@ -344,6 +344,11 @@ as_app_builder_search_translations_qt (AsAppBuilderContext *ctx, /* FIXME: this path probably has to be specified as an attribute * in the tag from the AppData file */ t = g_ptr_array_index (ctx->translations, i); + if (as_translation_get_kind (t) != AS_TRANSLATION_KIND_QT && + as_translation_get_kind (t) != AS_TRANSLATION_KIND_UNKNOWN) + continue; + if (as_translation_get_id (t) == NULL) + continue; install_dir = as_translation_get_id (t); path = g_build_filename (prefix, "share", @@ -360,11 +365,6 @@ as_app_builder_search_translations_qt (AsAppBuilderContext *ctx, while ((filename = g_dir_read_name (dir)) != NULL) { g_autofree gchar *fn = NULL; g_autofree gchar *locale = NULL; - if (as_translation_get_kind (t) != AS_TRANSLATION_KIND_QT && - as_translation_get_kind (t) != AS_TRANSLATION_KIND_UNKNOWN) - continue; - if (as_translation_get_id (t) == NULL) - continue; if (!g_str_has_prefix (filename, as_translation_get_id (t))) continue; locale = g_strdup (filename + strlen (as_translation_get_id (t)) + 1); -- cgit v1.2.1