Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-01-30 19:39:28 +0300
committerJoas Schilling <nickvergessen@gmx.de>2015-01-30 19:39:28 +0300
commitb58f2faf21f99119cfa7f7590591fcb4bbd0fb8d (patch)
treeff99831bfce84eb8643ce6c79f644d0eac6e9d20
parente7900ba255df677fbea718e73e52931f8950c811 (diff)
parent7bd7c202953c46d9433c295eeea09f455a7ccc5c (diff)
Merge pull request #13804 from owncloud/check-return-before-assuming-array
Check whether return is an error case before using it
-rw-r--r--settings/controller/appsettingscontroller.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/settings/controller/appsettingscontroller.php b/settings/controller/appsettingscontroller.php
index 816b7b2e65c..72403437bb8 100644
--- a/settings/controller/appsettingscontroller.php
+++ b/settings/controller/appsettingscontroller.php
@@ -67,11 +67,13 @@ class AppSettingsController extends Controller {
$categories[] = ['id' => 2, 'displayName' => (string)$this->l10n->t('Recommended')];
// apps from external repo via OCS
$ocs = \OC_OCSClient::getCategories();
- foreach($ocs as $k => $v) {
- $categories[] = array(
- 'id' => $k,
- 'displayName' => str_replace('ownCloud ', '', $v)
- );
+ if ($ocs) {
+ foreach($ocs as $k => $v) {
+ $categories[] = array(
+ 'id' => $k,
+ 'displayName' => str_replace('ownCloud ', '', $v)
+ );
+ }
}
}
@@ -124,9 +126,11 @@ class AppSettingsController extends Controller {
default:
if ($category === 2) {
$apps = \OC_App::getAppstoreApps('approved');
- $apps = array_filter($apps, function ($app) {
- return isset($app['internalclass']) && $app['internalclass'] === 'recommendedapp';
- });
+ if ($apps) {
+ $apps = array_filter($apps, function ($app) {
+ return isset($app['internalclass']) && $app['internalclass'] === 'recommendedapp';
+ });
+ }
} else {
$apps = \OC_App::getAppstoreApps('approved', $category);
}