diff --git a/CHANGELOG.md b/CHANGELOG.md index 4acfff966..c273ab74b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,8 @@ All notable changes to this project will be documented in this file. - [#2138] FLA Export - Mask layer was visible when did not contain a masked layer - FLA Export - frame numbering problem - [#2145] FLA Export - missing frames, cliping layers order, nullpointer, empty sound layers +- [#2142] XML Export - string values containing only spaces +- AS3 - Nullpointer in MethodBody when no ABC set ### Changed - [#2120] Exported assets no longer take names from assigned classes if there is more than 1 assigned class @@ -3352,6 +3354,7 @@ Major version of SWF to XML export changed to 2. [#2136]: https://www.free-decompiler.com/flash/issues/2136 [#2139]: https://www.free-decompiler.com/flash/issues/2139 [#2145]: https://www.free-decompiler.com/flash/issues/2145 +[#2142]: https://www.free-decompiler.com/flash/issues/2142 [#2120]: https://www.free-decompiler.com/flash/issues/2120 [#1130]: https://www.free-decompiler.com/flash/issues/1130 [#1220]: https://www.free-decompiler.com/flash/issues/1220 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 54720651f..d52ff7962 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -144,13 +144,15 @@ public final class MethodBody implements Cloneable { } } - public synchronized AVM2Code getCode() { + public synchronized AVM2Code getCode() { if (code == null) { AVM2Code avm2Code; try { ABCInputStream ais = new ABCInputStream(new MemoryInputStream(codeBytes)); avm2Code = new AVM2Code(ais, this); - avm2Code.removeWrongIndices(abc.constants); + if (abc != null) { + avm2Code.removeWrongIndices(abc.constants); + } } catch (UnknownInstructionCode | IOException ex) { avm2Code = new AVM2Code(); logger.log(Level.SEVERE, null, ex); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java index 1d560ebe6..316acd6b3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/swf/SwfXmlExporter.java @@ -53,7 +53,7 @@ import javax.xml.stream.XMLStreamWriter; public class SwfXmlExporter { public static final int XML_EXPORT_VERSION_MAJOR = 2; - public static final int XML_EXPORT_VERSION_MINOR = 0; + public static final int XML_EXPORT_VERSION_MINOR = 1; private static final Logger logger = Logger.getLogger(SwfXmlExporter.class.getName()); @@ -158,7 +158,7 @@ public class SwfXmlExporter { if (isListItem) { writer.writeStartElement(name); - writer.writeCharacters(stringValue); + writer.writeCharacters(stringValue); writer.writeEndElement(); } else { writer.writeAttribute(name, stringValue); diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index 42ed89179..032b2b0cd 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -1321,6 +1321,14 @@ public class Helper { } public static String escapeXmlExportString(String s) { + if (s.matches("^ +$")) { + StringBuilder ret = new StringBuilder(s.length()); + for (int i = 0; i < s.length(); i++) { + ret.append("\\u0020"); + } + return ret.toString(); + } + StringBuilder ret = new StringBuilder(s.length()); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i);