summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Farfan <fernando@endlessm.com>2015-08-28 20:11:06 -0600
committerFernando Farfan <fernando@endlessm.com>2015-08-28 20:11:06 -0600
commitaf2bda2d010164308686f2c38b80c3dd21f10606 (patch)
treed8504d60b962933ded15da35b1831791ffc1f49b
parentc406adc8ed23c0e8ee693a4d76744b1e4cf170c5 (diff)
parent0418b073e8c27bd8e187963c76e2066f5bfc806a (diff)
Merge pull request #3554 from endlessm/sdk/3532
Don't throw an assertion on missing license codes
-rw-r--r--endless/eosattribution.c2
-rw-r--r--endless/eoslicense.c18
2 files changed, 10 insertions, 10 deletions
diff --git a/endless/eosattribution.c b/endless/eosattribution.c
index c930169..87d0876 100644
--- a/endless/eosattribution.c
+++ b/endless/eosattribution.c
@@ -226,7 +226,7 @@ render_license_link (GtkTreeViewColumn *column,
string. Note: this string is markup, and so should not contain any
ampersands (&), less-than signs (<), or greater-than signs (>). */
gchar *license_string = g_strdup_printf (_("%s."),
- gettext (eos_get_license_display_name (license_code)));
+ eos_get_license_display_name (license_code));
gboolean behave_like_link = (license_uri != NULL);
g_object_set (renderer,
"markup", license_string,
diff --git a/endless/eoslicense.c b/endless/eoslicense.c
index d080942..5d7301f 100644
--- a/endless/eoslicense.c
+++ b/endless/eoslicense.c
@@ -173,10 +173,11 @@ eos_get_license_display_name (const gchar *license)
g_free (sanitized_license);
/* If the array value is null, it means we don't have a license file for that
- license name. */
- g_return_val_if_fail (recognized_licenses[index] != NULL, NULL);
+ license name. */
+ if (recognized_licenses[index] == NULL)
+ return _("Unknown license");
- return recognized_licenses_display_names[index];
+ return gettext (recognized_licenses_display_names[index]);
}
/**
@@ -185,9 +186,11 @@ eos_get_license_display_name (const gchar *license)
*
* Retrieves a GFile for the specified licene and the current locale.
*
- * Returns: (transfer full): A GFile for the specified @license name and the
- * current locale. It returns NULL if the license
- * is not found or does not have an associated file.
+ * Returns: (transfer full) (allow-none): A GFile for the specified @license
+ * name and the current locale. It
+ * returns %NULL if the license is not
+ * found or does not have an associated
+ * file.
* Since: 0.4
*/
GFile *
@@ -199,9 +202,6 @@ eos_get_license_file (const gchar *license)
int index = get_license_index (sanitized_license);
g_free (sanitized_license);
- /* If the code array value is null, it means it is an unrecognized license code. */
- g_return_val_if_fail (recognized_licenses[index] != NULL, NULL);
-
/* If the array value is null, it means we don't have a license file for that
license name. */
if (recognized_licenses_filenames[index] == NULL)