fix: comparison of integers of different signs (#6749)
The `targetIndex` (`int`) was compared to `maxIndex` (`size_t`). This generated a large warning, because it was in a lambda. Since we parse `targetIndex`, we can parse it as a `size_t`.
This commit is contained in:
@@ -280,7 +280,7 @@ QString completePrediction(const CommandContext &ctx)
|
||||
return "";
|
||||
}
|
||||
|
||||
int targetIndex = 0;
|
||||
size_t targetIndex = 0;
|
||||
QString targetName;
|
||||
if (hasName)
|
||||
{
|
||||
@@ -289,8 +289,8 @@ QString completePrediction(const CommandContext &ctx)
|
||||
else
|
||||
{
|
||||
bool ok = true;
|
||||
targetIndex = parser.value(indexOption).toInt(&ok);
|
||||
if (!ok || targetIndex <= 0)
|
||||
targetIndex = parser.value(indexOption).toULongLong(&ok);
|
||||
if (!ok || targetIndex == 0)
|
||||
{
|
||||
ctx.channel->addSystemMessage("Invalid index - " + usage);
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user