From 378f35f0ec7145b6ddeca4023a3a8bdadb450cc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Fri, 1 Aug 2014 09:54:32 +0200
Subject: [PATCH] prevent PHP errors and enhance logging

---
 lib/private/ocsclient.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index dc52fc27b5..e1db0995ea 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -162,7 +162,7 @@ class OC_OCSClient{
 		$xml=OC_OCSClient::getOCSresponse($url);
 
 		if($xml==false) {
-			OC_Log::write('core', 'Unable to parse OCS content', OC_Log::FATAL);
+			OC_Log::write('core', 'Unable to parse OCS content for app ' . $id, OC_Log::FATAL);
 			return null;
 		}
 		$loadEntities = libxml_disable_entity_loader(true);
@@ -170,6 +170,10 @@ class OC_OCSClient{
 		libxml_disable_entity_loader($loadEntities);
 
 		$tmp=$data->data->content;
+		if (is_null($tmp)) {
+			OC_Log::write('core', 'Invalid OCS content returned for app ' . $id, OC_Log::FATAL);
+			return null;
+		}
 		$app=array();
 		$app['id']=$tmp->id;
 		$app['name']=$tmp->name;
-- 
GitLab