Binary paths array was wrongly iterated up to binaryPaths->length(), which is actually a length of the first string in array, not the array length itself. Rewriting array into a list, so that it could be iterated automatically, without explicitly providing an index range

This commit is contained in:
Dmitry Mikushin
2023-02-07 23:56:04 +01:00
parent 8ca2610550
commit 5862ba2d97
2 changed files with 10 additions and 11 deletions

View File

@@ -34,9 +34,9 @@ GPService::~GPService()
QString GPService::findBinary()
{
for (int i = 0; i < binaryPaths->length(); i++) {
if (QFileInfo::exists(binaryPaths[i])) {
return binaryPaths[i];
for (auto& binaryPath : binaryPaths) {
if (QFileInfo::exists(binaryPath)) {
return binaryPath;
}
}
return nullptr;