Fixed #2178 Tag undo

This commit is contained in:
Jindra Petřík
2024-08-05 11:17:25 +02:00
parent 6e1f233d3d
commit e1464270b6
@@ -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);
}