Skip to content

Commit

Permalink
Fix index check
Browse files Browse the repository at this point in the history
Also fixes handling of empty netrc.

Signed-off-by: Fredrik Eriksson <[email protected]>
  • Loading branch information
fredrik-eriksson authored and mgallien committed Jan 3, 2025
1 parent d3e375e commit 89d08a0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cmd/netrcparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ bool NetrcParser::parse()
return false;
}
QString content = netrc.readAll();
if (content.isEmpty()) {
return false;
}

auto tokens = content.split(QRegularExpression("\\s+"));

Expand All @@ -71,9 +74,9 @@ bool NetrcParser::parse()
}

i++;
if (i > tokens.count()) {
if (i >= tokens.count()) {
qDebug() << "error fetching value for" << key;
return false;
break;
}
auto value = tokens[i];

Expand Down

0 comments on commit 89d08a0

Please sign in to comment.