Skip to content

Commit 5dae769

Browse files
author
John Keyes
committed
applied a fix to prevent a NPE, reported by Boon Hian Tek
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@129849 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0f52eff commit 5dae769

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/java/org/apache/commons/cli/CommandLine.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ public boolean hasOption( char opt ) {
135135
public Object getOptionObject( String opt ) {
136136
String res = getOptionValue( opt );
137137

138+
if( !options.containsKey( opt ) ) {
139+
return null;
140+
}
138141
Object type = ((Option)options.get(opt)).getType();
139142
return res == null ? null : TypeHandler.createValue(res, type);
140143
}

0 commit comments

Comments
 (0)