From b3e7485612f6ab0679e35a7c9ab54bf9bbdc66d6 Mon Sep 17 00:00:00 2001
From: Tom Needham <tom@owncloud.com>
Date: Thu, 25 Apr 2013 01:08:11 +0100
Subject: [PATCH] Correct the api response when both a shipped app and/or a
 third party app fail

---
 lib/api.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/api.php b/lib/api.php
index 8d6bbb7cc0..12eea52d3b 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -155,11 +155,11 @@ class OC_API {
 			// They may have failed for different reasons (different status codes)
 			// Which reponse code should we return?
 			// Maybe any that are not OC_API::RESPOND_SERVER_ERROR
-			$response = $shipped['failed'][0];
+			$response = reset($shipped['failed']);
 			return $response;
 		} else {
 			// Return the third party failure result
-			$response = $thirdparty['failed'][0];
+			$response = reset($thirdparty['failed']);
 			return $response;
 		}
 		// Merge the successful responses
-- 
GitLab