Skip to content

Commit

Permalink
[backend] fix null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
savacano28 committed Sep 27, 2024
1 parent 6b85973 commit cbc4dc8
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,15 @@ public InjectStatusCommandLine getCommandsLinesFromInject(final Inject inject) {
// Inject has a command payload
Payload payload = injectorContract.getPayload();
Command payloadCommand = (Command) Hibernate.unproxy(payload);
return new InjectStatusCommandLine(!payloadCommand.getContent().isBlank() ? List.of(payloadCommand.getContent()) : null,
!payloadCommand.getCleanupCommand().isBlank() ? List.of(payload.getCleanupCommand()) : null, payload.getExternalId());
return new InjectStatusCommandLine(

Check warning on line 439 in openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java

View check run for this annotation

Codecov / codecov/patch

openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java#L439

Added line #L439 was not covered by tests
payloadCommand.getContent() != null && !payloadCommand.getContent().isBlank()
? List.of(payloadCommand.getContent())
: null,

Check warning on line 442 in openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java

View check run for this annotation

Codecov / codecov/patch

openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java#L441-L442

Added lines #L441 - L442 were not covered by tests
payloadCommand.getCleanupCommand() != null && !payloadCommand.getCleanupCommand().isBlank()
? List.of(payloadCommand.getCleanupCommand())
: null,
payload.getExternalId()

Check warning on line 446 in openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java

View check run for this annotation

Codecov / codecov/patch

openbas-api/src/main/java/io/openbas/service/AtomicTestingService.java#L444-L446

Added lines #L444 - L446 were not covered by tests
);
} else {
// Inject comes from Caldera ability and tomorrow from other(s) Executor(s)
io.openbas.execution.Injector executor = context.getBean(injectorContract.getInjector().getType(), io.openbas.execution.Injector.class);
Expand Down

0 comments on commit cbc4dc8

Please sign in to comment.