From f1c5dce75c5f1bc2c9d7022a8b43577a3dec9629 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Tue, 31 Jan 2012 16:33:16 +0100
Subject: [PATCH] dont try to use something that isn't there

---
 files/ajax/scan.php | 6 +++++-
 lib/filecache.php   | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/files/ajax/scan.php b/files/ajax/scan.php
index 37ce7ab71f..f7e75d5f8b 100644
--- a/files/ajax/scan.php
+++ b/files/ajax/scan.php
@@ -22,6 +22,10 @@ if($force or !OC_FileCache::inCache('')){
 		exit;
 	}
 }else{
-	$eventSource->send('success',false);
+	if(isset($eventSource)){
+		$eventSource->send('success',false);
+	}else{
+		exit;
+	}
 }
 $eventSource->close();
\ No newline at end of file
diff --git a/lib/filecache.php b/lib/filecache.php
index 689680624a..b4cafe8b31 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -325,7 +325,9 @@ class OC_FileCache{
 						$mimetype=OC_Filesystem::getMimeType($file);
 						$stat['mimetype']=$mimetype;
 						self::put($file,$stat);
-						$eventSource->send('scanned',$file);
+						if($eventSource){
+							$eventSource->send('scanned',$file);
+						}
 						$totalSize+=$stat['size'];
 					}
 				}
-- 
GitLab