Don't initialise a DiskOptimisedClipboard before checking for an existing one in the LocalSession when using loadClipboardFromDisk (#1731)

This commit is contained in:
Jordan 2022-05-09 12:50:19 +01:00 committed by GitHub
parent b85888806a
commit 267dc153f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,7 +463,6 @@ public interface Player extends Entity, Actor {
);
try {
if (file.exists() && file.length() > 5) {
DiskOptimizedClipboard doc = new DiskOptimizedClipboard(file);
LocalSession session = getSession();
try {
if (session.getClipboard() != null) {
@ -471,9 +470,10 @@ public interface Player extends Entity, Actor {
}
} catch (EmptyClipboardException ignored) {
}
DiskOptimizedClipboard doc = new DiskOptimizedClipboard(file);
Clipboard clip = doc.toClipboard();
ClipboardHolder holder = new ClipboardHolder(clip);
getSession().setClipboard(holder);
session.setClipboard(holder);
}
} catch (FaweClipboardVersionMismatchException e) {
print(Caption.of("fawe.error.clipboard.on.disk.version.mismatch"));