UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

Exception: Malformed switch statement

Open themabus opened this issue 3 years ago • 2 comments

Describe the bug

/* EXCEPTION!
   System.Exception: Malformed switch statement: bad condition var (y)
   at UndertaleModLib.Decompiler.Decompiler.HLDecompileBlocks(DecompileContext context, Block& block, Dictionary`2 blocks, Dictionary`2 loops, Dictionary`2 reverseDominators, List`1 alreadyVisited, Block currentLoop, Block stopAt, Block breakTo, Boolean decompileTheLoop, UInt32 depth) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3493
   at UndertaleModLib.Decompiler.Decompiler.HLDecompile(DecompileContext context, Dictionary`2 blocks, Block entryPoint, Block rootExitPoint) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3660
   at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3772
   at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass31_1.<DecompileCode>b__1() in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 456
*/

this Exception is caused by decompilation of following line of GML from GMS 1.4.9999

x = 2 - ((y == 1) || (x == 0));

Exception log above is from 674c5d8 but this issue is also present in 0.4.0.4, 0.3.5.8, 0.3.0, 0.2.0, 0.1.25

Reproducing steps

open attached data.win and decompile object0.Create event bug_switch.zip

Setup Details

674c5d8 GMS 1.4.9999 Win10 x64

themabus avatar Jul 26 '22 13:07 themabus

See #452

Miepee avatar Jul 26 '22 13:07 Miepee

oh dang it. thank you

themabus avatar Jul 26 '22 13:07 themabus