Skip to content

Commit

Permalink
Prevent an empty choice list being passed in debug:container
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan authored and fabpot committed Oct 8, 2014
1 parent 46d18f4 commit ef23b63
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -184,7 +184,12 @@ private function findProperServiceName(InputInterface $input, OutputInterface $o
return $name;
}

$question = new ChoiceQuestion('Choose a number for more information on the service', $this->findServiceIdsContaining($builder, $name));
$matchingServices = $this->findServiceIdsContaining($builder, $name);
if (empty($matchingServices)) {
throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
}

$question = new ChoiceQuestion('Choose a number for more information on the service', $matchingServices);
$question->setErrorMessage('Service %s is invalid.');

return $this->getHelper('question')->ask($input, $output, $question);
Expand Down

0 comments on commit ef23b63

Please sign in to comment.