Skip to content

Commit

Permalink
Fixed crash when not enough paramters were given
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterMjir committed Dec 14, 2019
1 parent ec9e08b commit 859dec4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void Table::close()
bool foundFunc = false;
for (auto method : methods)
{
// NOTE: Make this better
if (function.compare(method->name) == 0)
{
foundFunc = true;
Expand All @@ -57,7 +58,9 @@ void Table::close()
else // Method is good to go
method->method(args);
}
else // Call function normally
else if (args.size() < method->argc) // Call function normally
std::cout << "Missing a parameter. For help try '" << method->name << " help'\n";
else // Call normally
method->method(args);

break; // Function is found so no need to continue the loop
Expand Down

0 comments on commit 859dec4

Please sign in to comment.