diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-01-30 16:39:57 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-01-30 16:39:57 +0100 |
commit | 7bd7c202953c46d9433c295eeea09f455a7ccc5c (patch) | |
tree | ff99831bfce84eb8643ce6c79f644d0eac6e9d20 /settings | |
parent | e7900ba255df677fbea718e73e52931f8950c811 (diff) | |
download | nextcloud-server-7bd7c202953c46d9433c295eeea09f455a7ccc5c.tar.gz nextcloud-server-7bd7c202953c46d9433c295eeea09f455a7ccc5c.zip |
Check whether return is an error case before using it
Diffstat (limited to 'settings')
-rw-r--r-- | settings/controller/appsettingscontroller.php | 20 |
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); } |