From bf4d4d9266522496f72063e6c34fd7f61b759fed Mon Sep 17 00:00:00 2001 From: Eauchat <34686393+eauchat@users.noreply.github.com> Date: Wed, 29 Sep 2021 09:09:01 +0000 Subject: [PATCH] Avoid formatI18nField to fail if field is undefined At the moment, it seems that if an app manifest custom argument is missing the "ask" property, the display of app install page is blank. --- app/src/helpers/yunohostArguments.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/helpers/yunohostArguments.js b/app/src/helpers/yunohostArguments.js index bcaea706..bb4067c8 100644 --- a/app/src/helpers/yunohostArguments.js +++ b/app/src/helpers/yunohostArguments.js @@ -8,13 +8,13 @@ import { isObjectLiteral, isEmptyValue, flattenObjectLiteral } from '@/helpers/c * Tries to find a translation corresponding to the user's locale/fallback locale in a * Yunohost argument or simply return the string if it's not an object literal. * - * @param {(Object|String)} field - A field value containing a translation object or string + * @param {(Object|String|undefined)} field - A field value containing a translation object or string * @return {String} */ export function formatI18nField (field) { if (typeof field === 'string') return field const { locale, fallbackLocale } = store.state - return field[locale] || field[fallbackLocale] || field.en + return field ? field[locale] || field[fallbackLocale] || field.en : '' }