Skip to content

Commit 9302fa1

Browse files
jonathanlukasgithub-actions[bot]
authored andcommitted
fix: prevent npe (#482)
* fix: prevent npe * fix: typos (cherry picked from commit 143caa3)
1 parent 66f383d commit 9302fa1

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Camunda TaskList Client
66

7-
This project was intially designed to simplify communication between a java backend and the Camunda 8 task list GraphQL APIs. Since GraphQL APIs are now deprecared, this client is now targetting REST endpoints. Contributions through PR are welcome!
7+
This project was intially designed to simplify communication between a java backend and the Camunda 8 task list GraphQL APIs. Since GraphQL APIs are now deprecated, this client is now targeting REST endpoints. Contributions through PR are welcome!
88

99
:information_source: 8.3+ Relesases of this client are generated against Rest endpoints.
1010

extension/client-java/src/main/java/io/camunda/tasklist/TasklistClientV1.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,17 @@ private static Form toForm(FormResponse formResponse) {
7575

7676
private static SaveVariablesRequest fromVariablesToSave(List<RequestVariable> variables) {
7777
SaveVariablesRequest request = new SaveVariablesRequest();
78-
request.setVariables(variables.stream().map(TasklistClientV1::fromVariable).toList());
78+
if (variables != null) {
79+
request.setVariables(variables.stream().map(TasklistClientV1::fromVariable).toList());
80+
}
7981
return request;
8082
}
8183

8284
private static TaskCompleteRequest fromVariablesToComplete(List<RequestVariable> variables) {
8385
TaskCompleteRequest request = new TaskCompleteRequest();
84-
request.setVariables(variables.stream().map(TasklistClientV1::fromVariable).toList());
86+
if (variables != null) {
87+
request.setVariables(variables.stream().map(TasklistClientV1::fromVariable).toList());
88+
}
8589
return request;
8690
}
8791

@@ -94,10 +98,12 @@ private static VariableInputDTO fromVariable(RequestVariable variable) {
9498

9599
private static VariablesSearchRequest fromVariableSearch(VariableSearch variableSearch) {
96100
VariablesSearchRequest request = new VariablesSearchRequest();
97-
request.setIncludeVariables(
98-
variableSearch.includeVariables().stream()
99-
.map(TasklistClientV1::fromIncludeVariable)
100-
.toList());
101+
if (variableSearch.includeVariables() != null) {
102+
request.setIncludeVariables(
103+
variableSearch.includeVariables().stream()
104+
.map(TasklistClientV1::fromIncludeVariable)
105+
.toList());
106+
}
101107
request.setVariableNames(variableSearch.variableNames());
102108
return request;
103109
}

0 commit comments

Comments
 (0)