From 85995ca008a3d028f3717b6e796db3c37838dcda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 11 Jul 2015 06:02:09 +0200 Subject: [PATCH] And/Or detection fix --- .../ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index 095b5607d..e6f1b53d1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -52,6 +52,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -1727,6 +1729,13 @@ public class Graph { stack.push(new TernarOpItem(null, expr.invert(null), ((PushItem) onTrue.get(0)).value, ((PushItem) onFalse.get(0)).value)); } else { boolean isIf = true; + //If the ontrue is empty, switch ontrue and onfalse + if (onTrue.isEmpty() && !onFalse.isEmpty()) { + expr = expr.invert(null); + List tmp = onTrue; + onTrue = onFalse; + onFalse = tmp; + } if (!stack.isEmpty() && onFalse.isEmpty() && ((onTrue.size() == 1 && (onTrue.get(0) instanceof PopItem)) || ((onTrue.size() == 2) && (onTrue.get(0) instanceof PopItem) && (onTrue.get(1) instanceof PushItem)))) { if (onTrue.size() == 2) { GraphTargetItem rightSide = ((PushItem) onTrue.get(1)).value;