Skip to content

Commit d7da889

Browse files
committed
[Fix #838] Fixing nullpointerexception in outputAs
Signed-off-by: fjtirado <[email protected]>
1 parent 37bd454 commit d7da889

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,14 @@ public WorkflowModel output() {
139139

140140
@Override
141141
public <T> T outputAs(Class<T> clazz) {
142-
return output
143-
.as(clazz)
144-
.orElseThrow(
145-
() ->
146-
new IllegalArgumentException(
147-
"Output " + output + " cannot be converted to class " + clazz));
142+
return output != null
143+
? output
144+
.as(clazz)
145+
.orElseThrow(
146+
() ->
147+
new IllegalArgumentException(
148+
"Output " + output + " cannot be converted to class " + clazz))
149+
: null;
148150
}
149151

150152
public void status(WorkflowStatus state) {

0 commit comments

Comments
 (0)