Fixed #2142 XML Export - string values containing only spaces

Fixed AS3 - Nullpointer in MethodBody when no ABC set
This commit is contained in:
Jindra Petřík
2023-12-30 18:06:08 +01:00
parent 2596650ed3
commit 7c2e41b1a9
4 changed files with 17 additions and 4 deletions
@@ -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);
@@ -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);