Browse Source

fix and improve check of create group result

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
pull/17896/head
Arthur Schiwon 7 years ago
parent
commit
b4408e4245
No known key found for this signature in database GPG Key ID: 7424F1874854DF23
  1. 4
      core/Command/Group/Add.php

4
core/Command/Group/Add.php

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OC\Core\Command\Group; namespace OC\Core\Command\Group;
use OC\Core\Command\Base; use OC\Core\Command\Base;
use OCP\IGroup;
use OCP\IGroupManager; use OCP\IGroupManager;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -68,7 +69,7 @@ class Add extends Base {
return 1; return 1;
} else { } else {
$group = $this->groupManager->createGroup($gid); $group = $this->groupManager->createGroup($gid);
if($group === false) {
if (!$group instanceof IGroup) {
$output->writeln('<error>Could not create group</error>'); $output->writeln('<error>Could not create group</error>');
return 2; return 2;
} }
@ -79,5 +80,6 @@ class Add extends Base {
$group->setDisplayName($displayName); $group->setDisplayName($displayName);
} }
} }
return 0;
} }
} }
Loading…
Cancel
Save