From 8a30050a9803fa95856f416b78a4b5107a8dfed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Sat, 29 Jun 2013 19:31:21 +0200 Subject: [PATCH] Issue #152 Empty if branches not inverted --- .../com/jpexs/decompiler/flash/graph/IfItem.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java b/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java index 5c2046f79..e6ba6ac48 100644 --- a/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/graph/IfItem.java @@ -52,13 +52,19 @@ public class IfItem extends GraphTargetItem implements Block { List ifBranch = onTrue; List elseBranch = onFalse; if (onTrue.isEmpty()) { - if (expr instanceof LogicalOpItem) { - expr = ((LogicalOpItem) expr).invert(); + if (onFalse.isEmpty()) { + if (expr instanceof NotItem) { + expr = ((NotItem) expr).getOriginal(); + } } else { - expr = new NotItem(null, expr); + if (expr instanceof LogicalOpItem) { + expr = ((LogicalOpItem) expr).invert(); + } else { + expr = new NotItem(null, expr); + } + ifBranch = onFalse; + elseBranch = onTrue; } - ifBranch = onFalse; - elseBranch = onTrue; } ret = hilight("if(") + expr.toString(localData) + hilight(")") + "\r\n{\r\n"; for (GraphTargetItem ti : ifBranch) {