if argc < 2 throw ParameterException

This commit is contained in:
lucaspalomodevelop 2023-10-03 17:27:45 +02:00
parent 15b2eb2fc0
commit 52fe8fa52f
2 changed files with 9 additions and 1 deletions

View File

@ -43,6 +43,14 @@ public:
void execute(int argc, char *argv[])
{
if (argc < 2)
{
std::cout << "Command not found" << std::endl;
throw lpstd::exceptions::ParameterException("argc < 2");
return;
}
std::string command = argv[1];
std::vector<std::string> args;
for (int i = 2; i < argc; i++)

View File

@ -6,7 +6,7 @@
using namespace lpstd::exceptions;
namespace commands
namespace commands
{
void add(int argc, char *argv[])
{