1 Commits
Author SHA1 Message Date
Symere 01bf4af552 fix(as2): correct Decrement cast and guard empty output in ActionSetMember (PR261)
handleSetMember crashed while decompiling AS2 code that applies `--` to a
virtual (`__get__`/`__set__`) property, e.g. `this.prop--` where `prop` is
defined via addProperty. The decrement-setter branch built a
PreDecrementActionItem but cast the value to IncrementActionItem instead of
DecrementActionItem, throwing ClassCastException.

That exception was then masked: it propagated into the finally block before
addToOutput ran, so `output` was empty and `output.remove(output.size() - 1)`
threw IndexOutOfBoundsException, replacing the real cause. The reported error
was therefore always a misleading "Index -1 out of bounds for length 0",
which also aborts loading entirely when "automatically rename identifiers" is
enabled (deobfuscateIdentifiers decompiles every script on load).

Fixes:
- Cast value to DecrementActionItem in the PreDecrement setter branch.
- Guard the finally against an empty output (mirrors cleanupTemp) so a future
  exception in the try block is no longer masked.

Affected code now decompiles correctly to `++prop` / `--prop`.
2026-05-24 09:07:34 +02:00