diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java index 220d4358d..e353f7a48 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/Tag.java @@ -459,12 +459,12 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable { return originalRange != null && isModified(); } - public void undo() throws InterruptedException, IOException { - byte[] data = getOriginalData(); - if (data == null) { //If the tag is newly created in GUI it has no original data + public void undo() throws InterruptedException, IOException { + if (originalRange == null) { //If the tag is newly created in GUI it has no original data return; } - SWFInputStream tagDataStream = new SWFInputStream(swf, data, getDataPos(), data.length); + SWFInputStream tagDataStream = new SWFInputStream(swf, originalRange.getArray(), 0, (int) originalRange.getPos() + originalRange.getLength()); + tagDataStream.seek(getDataPos()); readData(tagDataStream, getOriginalRange(), 0, false, true, false); setModified(false); }