fix: fault tolerance in the absence of a callback function (#2394)

This commit is contained in:
luzhuang
2024-10-30 19:00:40 +08:00
committed by GitHub
parent ff377753ac
commit aefd944347

View File

@@ -406,7 +406,7 @@ export class Animator extends Component {
handlers.length = 0;
for (let j = scriptCount - 1; j >= 0; j--) {
const script = scripts[j];
const handler = <Function>script[funcName].bind(script);
const handler = <Function>script[funcName]?.bind(script);
handler && handlers.push(handler);
}
eventHandlers.push(eventHandler);