Skip to content

Commit cba4695

Browse files
committed
Add null-checking to addRequired
1 parent fb3b7e7 commit cba4695

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/swagger-models/src/main/java/io/swagger/models/ModelImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ public void setFormat(String format) {
140140
}
141141

142142
public void addRequired(String name) {
143-
this.required.add(name);
143+
if (required == null) {
144+
required = new ArrayList<String>();
145+
}
146+
required.add(name);
144147
Property p = properties.get(name);
145148
if (p != null) {
146149
p.setRequired(true);

0 commit comments

Comments
 (0)