[gnome-pocket] Fix assertion when run in gir-scanner



commit 19bd5df88f36420fa8a38fca616ed9898a0b540a
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Sep 20 19:58:26 2014 +0200

    Fix assertion when run in gir-scanner

 gnome-pocket/gnome-pocket.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnome-pocket/gnome-pocket.c b/gnome-pocket/gnome-pocket.c
index 08074d3..4f586c9 100644
--- a/gnome-pocket/gnome-pocket.c
+++ b/gnome-pocket/gnome-pocket.c
@@ -679,10 +679,10 @@ gnome_pocket_class_init (GnomePocketClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  g_assert (g_get_prgname ());
-
-  cache_path = g_build_filename (g_get_user_cache_dir (), g_get_prgname (), NULL);
-  g_mkdir_with_parents (cache_path, 0700);
+  if (g_get_prgname ()) {
+    cache_path = g_build_filename (g_get_user_cache_dir (), g_get_prgname (), NULL);
+    g_mkdir_with_parents (cache_path, 0700);
+  }
 
   object_class->get_property = gnome_pocket_get_property;
   object_class->finalize = gnome_pocket_finalize;
@@ -908,6 +908,8 @@ client_ready_cb (GObject       *source_object,
 static void
 gnome_pocket_init (GnomePocket *self)
 {
+  g_assert (cache_path);
+
   self->priv = GNOME_POCKET_GET_PRIVATE (self);
   self->priv->cancellable = g_cancellable_new ();
   self->priv->proxy = rest_proxy_new ("https://getpocket.com/";, FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]