Skip to content
Snippets Groups Projects
Commit 7bd7c202 authored by Joas Schilling's avatar Joas Schilling
Browse files

Check whether return is an error case before using it

parent e7900ba2
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ class AppSettingsController extends Controller { ...@@ -67,6 +67,7 @@ class AppSettingsController extends Controller {
$categories[] = ['id' => 2, 'displayName' => (string)$this->l10n->t('Recommended')]; $categories[] = ['id' => 2, 'displayName' => (string)$this->l10n->t('Recommended')];
// apps from external repo via OCS // apps from external repo via OCS
$ocs = \OC_OCSClient::getCategories(); $ocs = \OC_OCSClient::getCategories();
if ($ocs) {
foreach($ocs as $k => $v) { foreach($ocs as $k => $v) {
$categories[] = array( $categories[] = array(
'id' => $k, 'id' => $k,
...@@ -74,6 +75,7 @@ class AppSettingsController extends Controller { ...@@ -74,6 +75,7 @@ class AppSettingsController extends Controller {
); );
} }
} }
}
$categories['status'] = 'success'; $categories['status'] = 'success';
$this->cache->set('listCategories', $categories, 3600); $this->cache->set('listCategories', $categories, 3600);
...@@ -124,9 +126,11 @@ class AppSettingsController extends Controller { ...@@ -124,9 +126,11 @@ class AppSettingsController extends Controller {
default: default:
if ($category === 2) { if ($category === 2) {
$apps = \OC_App::getAppstoreApps('approved'); $apps = \OC_App::getAppstoreApps('approved');
if ($apps) {
$apps = array_filter($apps, function ($app) { $apps = array_filter($apps, function ($app) {
return isset($app['internalclass']) && $app['internalclass'] === 'recommendedapp'; return isset($app['internalclass']) && $app['internalclass'] === 'recommendedapp';
}); });
}
} else { } else {
$apps = \OC_App::getAppstoreApps('approved', $category); $apps = \OC_App::getAppstoreApps('approved', $category);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment