diff options
author | Fernando Farfan <ffarfan@gmail.com> | 2015-08-27 15:14:18 -0600 |
---|---|---|
committer | Fernando Farfan <ffarfan@gmail.com> | 2015-08-28 20:10:32 -0600 |
commit | 6ff0a36615aebf2b776cec09f890483885414efd (patch) | |
tree | d39494197de6cd257a9cafff23b7e304f00a3029 | |
parent | c406adc8ed23c0e8ee693a4d76744b1e4cf170c5 (diff) |
Don't throw an assertion on missing license codes
We had originally added an assertion when the license API was called with an
invalid license shortname, but since right now those shortnames are handled
programatically by the applications, it is better to remove the asertion.
[endlessm/eos-sdk#3532]
-rw-r--r-- | endless/eoslicense.c | 18 |
1 files changed, 9 insertions, 9 deletions
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) |