From: Michael Terry <mterry@ubuntu.com>
Date: Wed, 11 Apr 2012 16:01:32 -0400
Subject: Don't try to announce the finish of a NULL job.

TODO: It isn't clear whether this is still needed. According to a
2013-11-04 comment upstream: "This is not reproducible on current git
master so it must have been fixed up in the meantime."

Origin: vendor, Ubuntu
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=576731
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/345754
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/838464
Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=576731#c5
---
 daemon/gvfschannel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/daemon/gvfschannel.c b/daemon/gvfschannel.c
index cc07988..c0c26da 100644
--- a/daemon/gvfschannel.c
+++ b/daemon/gvfschannel.c
@@ -612,7 +612,8 @@ send_reply_cb (GObject *source_object,
 
   job = channel->priv->current_job;
   channel->priv->current_job = NULL;
-  g_vfs_job_emit_finished (job);
+  if (job)
+    g_vfs_job_emit_finished (job);
 
   class = G_VFS_CHANNEL_GET_CLASS (channel);
   
@@ -633,7 +634,7 @@ send_reply_cb (GObject *source_object,
     }
   /* Start queued request or readahead */
   else if (!start_queued_request (channel) &&
-	   class->readahead)
+	   class->readahead && job)
     {
       /* No queued requests, maybe we want to do a readahead call */
       channel->priv->current_job = class->readahead (channel, job);
