Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[blockly] Fix missing event property causes JS error #2476

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@ export default function defineOHBlocks_Scripts (f7, isGraalJs, scripts) {
if (contextInfo === 'ruleUID') return ['ctx.ruleUID', javascriptGenerator.ORDER_ATOMIC]
if (contextInfo === 'itemState' || contextInfo === 'oldItemState' || contextInfo === 'itemCommand') {
if (type === 'asNumber') {
return [`parseFloat(event.${contextInfo}.toString())`, javascriptGenerator.ORDER_ATOMIC]
return [`parseFloat(event.${contextInfo}?.toString())`, javascriptGenerator.ORDER_ATOMIC]
stefan-hoehn marked this conversation as resolved.
Show resolved Hide resolved
} else if (type === 'asQuantity') {
return [`Quantity(event.${contextInfo}.toString())`, javascriptGenerator.ORDER_ATOMIC]
return [`Quantity(event.${contextInfo}?.toString())`, javascriptGenerator.ORDER_ATOMIC]
stefan-hoehn marked this conversation as resolved.
Show resolved Hide resolved
} else {
return [`event.${contextInfo}.toString()`, javascriptGenerator.ORDER_ATOMIC]
return [`event.${contextInfo}?.toString()`, javascriptGenerator.ORDER_ATOMIC]
}
}
return [`event.${contextInfo}`, javascriptGenerator.ORDER_ATOMIC]
Expand Down