summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalev Lember <klember@redhat.com>2019-11-14 14:26:46 +0100
committerKalev Lember <klember@redhat.com>2019-11-14 15:42:20 +0100
commitcea76b901569f8b0c384abe325db37fe445fd341 (patch)
treea523857897eea0405ff476ea95fcf91a069f943e
parent70b96eeb787fc8b698f58cf7cc1e1bc016367fe4 (diff)
downloadappstream-glib-cea76b901569f8b0c384abe325db37fe445fd341.tar.gz
trivial: Move a check earlier so that we exit the correct loop
-rw-r--r--libappstream-glib/as-app-builder.c10
1 files 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 <translations> 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);