Skip to content

Commit efb3845

Browse files
authored
Check that flag match query is not null (#4)
Without this check it causes the method to falsely match if either name is `null`.
2 parents fe992b5 + 1decc76 commit efb3845

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cmd/flag.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public class Flag {
100100
* query = String to check.
101101
*/
102102
public bool matches(string query) const nothrow @safe {
103+
if (query == null)
104+
return false;
103105
return
104106
(query.startsWith("--") && longName == query[2..$])
105107
|| (query.startsWith("-") && shortName == query[1..2])

0 commit comments

Comments
 (0)