diff options
author | Richard Hughes <richard@hughsie.com> | 2015-11-02 14:50:17 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-11-02 14:50:19 +0000 |
commit | 1bcc228abfeab9ee69d3d616ab6b5467aa6fa386 (patch) | |
tree | c9d576ed515111bd2c8fc6f0a7c2507c5eb3ef5a | |
parent | 6e1ff4c5aa97bfb4ab3382931d68b65af5967960 (diff) | |
download | appstream-glib-1bcc228abfeab9ee69d3d616ab6b5467aa6fa386.tar.gz |
Return the correct error when the desktop file has no [Desktop Entry] group
Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=754313
-rw-r--r-- | libappstream-glib/as-app-desktop.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libappstream-glib/as-app-desktop.c b/libappstream-glib/as-app-desktop.c index eb9cdc2..7155a13 100644 --- a/libappstream-glib/as-app-desktop.c +++ b/libappstream-glib/as-app-desktop.c @@ -411,6 +411,16 @@ as_app_parse_desktop_file (AsApp *app, return FALSE; } + /* check this is a valid desktop file */ + if (!g_key_file_has_group (kf, G_KEY_FILE_DESKTOP_GROUP)) { + g_set_error (error, + AS_APP_ERROR, + AS_APP_ERROR_INVALID_TYPE, + "Not a desktop file: no [%s]", + G_KEY_FILE_DESKTOP_GROUP); + return FALSE; + } + /* create app */ app_id = g_path_get_basename (desktop_file); as_app_set_id_kind (app, AS_ID_KIND_DESKTOP); |