Skip to content

Commit 500ddcf

Browse files
committed
Check if model exists in listing. A fuse to prevent NPE.
1 parent 1e96ab7 commit 500ddcf

File tree

1 file changed

+2
-2
lines changed
  • springfox-spring-web/src/main/java/springfox/documentation/spring/web/scanners

1 file changed

+2
-2
lines changed

springfox-spring-web/src/main/java/springfox/documentation/spring/web/scanners/ApiModelReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ private Set<String> findSameModels(
291291
for (ModelReference modelReference : rootModel.getSubTypes()) {
292292
Optional<String> modelId = getModelId(modelReference);
293293

294-
if (modelId.isPresent()) {
294+
if (modelId.isPresent() && mergingContext.containsModel(modelId.get())) {
295295
String sModelId = modelId.get();
296296
ModelContext modelContext = Optional.ofNullable(parametersMatching.get(sModelId))
297297
.map(op -> op.orElseGet(() -> parameter))
@@ -311,7 +311,7 @@ private Set<String> findSameModels(
311311
ModelReference modelReference = property.getModelRef();
312312
Optional<String> modelId = getModelId(modelReference);
313313

314-
if (modelId.isPresent()) {
314+
if (modelId.isPresent() && mergingContext.containsModel(modelId.get())) {
315315
String sModelId = modelId.get();
316316
ModelContext modelContext = Optional.ofNullable(parametersMatching.get(sModelId))
317317
.map(op -> op.orElseGet(() -> parameter))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy