fix-segfault.patch 829 B

12345678910111213141516171819202122232425
  1. From 0d64bbddaa0078ef148d609a3cfad854cf00d7de Mon Sep 17 00:00:00 2001
  2. From: Martin Pitt <martinpitt@gnome.org>
  3. Date: Fri, 08 Nov 2013 13:59:50 +0000
  4. Subject: lib: Fix segfault on getting property when daemon is not running
  5. This fixes "upower --version" when the daemon is not running, and thus the
  6. client proxy is NULL.
  7. ---
  8. diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c
  9. index 35d7b5d..17fb02d 100644
  10. --- a/libupower-glib/up-client.c
  11. +++ b/libupower-glib/up-client.c
  12. @@ -322,6 +322,9 @@ up_client_get_property (GObject *object,
  13. UpClient *client;
  14. client = UP_CLIENT (object);
  15. + if (client->priv->proxy == NULL)
  16. + return;
  17. +
  18. switch (prop_id) {
  19. case PROP_DAEMON_VERSION:
  20. g_value_set_string (value, up_client_glue_get_daemon_version (client->priv->proxy));
  21. --
  22. cgit v0.9.0.2-2-gbebe