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 0696f51 commit 42508c4
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(
payloadCommand.getContent() != null && !payloadCommand.getContent().isBlank()
? List.of(payloadCommand.getContent())
: null,
payloadCommand.getCleanupCommand() != null && !payloadCommand.getCleanupCommand().isBlank()
? List.of(payloadCommand.getCleanupCommand())
: null,
payload.getExternalId()
);
} 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 42508c4

Please sign in to comment.