This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 2ea8bed07beeb125c638192acfb1bd522ad8a120 Author: Josh Tynjala <[email protected]> AuthorDate: Mon Jul 15 12:44:12 2024 -0700 ABCGeneratingReducer: fix NullPointerException when assigning to a property that has a getter, but no setter --- .../compiler/internal/as/codegen/ABCGeneratingReducer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGeneratingReducer.java b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGeneratingReducer.java index e07c50d1c..afa8fdc9c 100644 --- a/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGeneratingReducer.java +++ b/compiler/src/main/java/org/apache/royale/compiler/internal/as/codegen/ABCGeneratingReducer.java @@ -1401,14 +1401,20 @@ public class ABCGeneratingReducer if (!inlined) { IDefinition def = target.getDefinition(); + // if the definition is a getter, we need the setter instead if (def instanceof GetterDefinition) { boolean isSuper = target.isSuperQualified(); SetterDefinition setter = (SetterDefinition)((GetterDefinition)def). resolveCorrespondingAccessor(currentScope.getProject()); - target = currentScope.getBinding(setter); - if (isSuper) - target.setSuperQualified(true); + // a setter may not exist. we don't need to report a + // problem, though. that's handled elsewhere. + if (setter != null) + { + target = currentScope.getBinding(setter); + if (isSuper) + target.setSuperQualified(true); + } } result.addAll(currentScope.findProperty(target, false)); result.addInstruction(OP_swap);
