Skip to content

Commit 9722528

Browse files
authored
[elsa] typeFilter对入参o的属性增加空指针校验 (#104)
1 parent 912db63 commit 9722528

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

framework/elsa/fit-elsa-react/src/components/variableAggregation/VariableAggregationInputForm.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,19 @@ const VariableItem = ({variable, variables, shapeStatus}) => {
158158
}
159159

160160
// 只有一个已引用变量,并且变量是自身,也可以换类型.
161-
if (referencedVariables.length === 1) {
162-
if (referencedVariables[0].id === variable.id) {
161+
if (referencedVariables.length === 1 && referencedVariables[0].id === variable.id) {
163162
return true;
164-
}
165163
}
166164

167165
// o所代表的observable已被引用了,不可再次引用.
168166
if (referencedVariables.some(r => r.referenceId === o.observableId)) {
169167
return false;
170168
}
171169

172-
return o.type.toUpperCase() === referencedVariables[0]?.type?.toUpperCase() ?? DATA_TYPES.STRING.toUpperCase();
170+
const defaultType = DATA_TYPES?.STRING?.toUpperCase() ?? "STRING"; // 防御性兜底
171+
const oType = o?.type?.toUpperCase() ?? defaultType;
172+
const refType = referencedVariables[0]?.type?.toUpperCase() ?? defaultType;
173+
return oType === refType;
173174
};
174175

175176
// 删除变量.

0 commit comments

Comments
 (0)