Ensure that transfer data can be retrieved

MYC-Refactor
Hammy 3 years ago
parent 6beeaafad9
commit 0e76d29495

@ -31,7 +31,9 @@ abstract class ClipboardListener {
String newContent = null; String newContent = null;
try { try {
newContent = (String) clipboardContents.getTransferData(TEXT.getDataFlavor()); if (clipboardContents.isDataFlavorSupported(TEXT.getDataFlavor())) {
newContent = (String) clipboardContents.getTransferData(TEXT.getDataFlavor());
}
} catch (UnsupportedFlavorException | IOException exp) { } catch (UnsupportedFlavorException | IOException exp) {
exp.printStackTrace(); exp.printStackTrace();
} }
@ -63,7 +65,9 @@ abstract class ClipboardListener {
List<File> fileList = null; List<File> fileList = null;
try { try {
fileList = (List<File>) clipboardContents.getTransferData(FILELIST.getDataFlavor()); if (clipboardContents.isDataFlavorSupported(FILELIST.getDataFlavor())) {
fileList = (List<File>) clipboardContents.getTransferData(FILELIST.getDataFlavor());
}
} catch (UnsupportedFlavorException | IOException exp) { } catch (UnsupportedFlavorException | IOException exp) {
exp.printStackTrace(); exp.printStackTrace();
} }

Loading…
Cancel
Save