Skip to content

Commit f49632b

Browse files
Fix index check
Also fixes handling of empty netrc. Signed-off-by: Fredrik Eriksson <[email protected]>
1 parent 3957917 commit f49632b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cmd/netrcparser.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ bool NetrcParser::parse()
5656
return false;
5757
}
5858
QString content = netrc.readAll();
59+
if (content.isEmpty()) {
60+
return false;
61+
}
5962

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

@@ -71,9 +74,9 @@ bool NetrcParser::parse()
7174
}
7275

7376
i++;
74-
if (i > tokens.count()) {
77+
if (i >= tokens.count()) {
7578
qDebug() << "error fetching value for" << key;
76-
return false;
79+
break;
7780
}
7881
auto value = tokens[i];
7982

0 commit comments

Comments
 (0)