From e317551d573a2dc4797ef5d2cd0ce6e8337f18f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 2 Jul 2025 21:42:03 +0200 Subject: [PATCH] Fixed Nullpointer in uninitialized class fields detector --- .../as2/UninitializedClassFieldsDetector.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/UninitializedClassFieldsDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/UninitializedClassFieldsDetector.java index a6c9bd6df..720b9b7a1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/UninitializedClassFieldsDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/as2/UninitializedClassFieldsDetector.java @@ -36,7 +36,6 @@ import com.jpexs.decompiler.flash.tags.base.ASMSource; import com.jpexs.decompiler.graph.AbstractGraphTargetVisitor; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.GraphTargetItem; -import com.jpexs.helpers.Cache; import com.jpexs.helpers.CancellableWorker; import com.jpexs.helpers.ProgressListener; import java.util.ArrayList; @@ -243,13 +242,15 @@ public class UninitializedClassFieldsDetector { } }; - worker.addCancelListener(cancelListener); + if (worker != null) { + worker.addCancelListener(cancelListener); + } try { asms.entrySet().parallelStream() .filter(item -> item.getValue() instanceof DoInitActionTag) .forEach(entry -> { - if (worker.isCancelled()) { + if (worker != null && worker.isCancelled()) { return; } subThreads.add(Thread.currentThread()); @@ -372,7 +373,7 @@ public class UninitializedClassFieldsDetector { }); - if (worker.isCancelled()) { + if (worker != null && worker.isCancelled()) { throw new InterruptedException(); } @@ -390,13 +391,13 @@ public class UninitializedClassFieldsDetector { } } - if (worker.isCancelled()) { + if (worker != null && worker.isCancelled()) { throw new InterruptedException(); } //getting static classname.x assigns asms.entrySet().parallelStream().forEach(entry -> { - if (worker.isCancelled()) { + if (worker != null && worker.isCancelled()) { return; } subThreads.add(Thread.currentThread()); @@ -450,7 +451,7 @@ public class UninitializedClassFieldsDetector { } }); - if (worker.isCancelled()) { + if (worker != null && worker.isCancelled()) { throw new InterruptedException(); } @@ -460,10 +461,7 @@ public class UninitializedClassFieldsDetector { for(String name:result.get(cls).keySet()) { System.err.println("- " +result.get(cls).get(name)); } - }*/ - if (worker.isCancelled()) { - throw new InterruptedException(); - } + }*/ return result; } finally { //Removed cached version of classes - allow reparsing using detected uninitialized fields @@ -477,7 +475,9 @@ public class UninitializedClassFieldsDetector { } } } - worker.removeCancelListener(cancelListener); + if (worker != null) { + worker.removeCancelListener(cancelListener); + } } } }