Skip to content

Commit

Permalink
Avoid to change a variable type when checking its type (#6587)
Browse files Browse the repository at this point in the history
- Don't show in changelog
  • Loading branch information
D8H committed May 24, 2024
1 parent eaebc16 commit 916e642
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Core/GDCore/IDE/Events/ExpressionVariablePathFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class GD_CORE_API ExpressionVariablePathFinder
auto *variable = typeFinder.WalkUntilLastChild(
typeFinder.variablesContainer->Get(typeFinder.variableName),
typeFinder.childVariableNames);
if (variable && variable->GetType() != gd::Variable::Array) {
return gd::Variable::Unknown;
}
return variable && variable->GetChildrenCount() > 0
? variable->GetAtIndex(0).GetType()
: gd::Variable::Unknown;
Expand Down
4 changes: 3 additions & 1 deletion newIDE/app/src/EventsSheet/ParameterFields/VariableField.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ export default React.forwardRef<Props, VariableFieldInterface>(
: null;
const needManualTypeSwitcher =
isSwitchableInstruction &&
variableType === gd.Variable.Unknown &&
variableType !== gd.Variable.Number &&
variableType !== gd.Variable.String &&
variableType !== gd.Variable.Boolean &&
!errorText &&
value;

Expand Down

0 comments on commit 916e642

Please sign in to comment.