Check clipboard contents for safety.

Problems can occur within these helper functions as the polling is extremely quick, causing for an edge case where the user copies content before the clipboard has time to process the contents
MYC-Refactor
sgoudham 3 years ago
parent a4665bf9a8
commit 57b4b96877
No known key found for this signature in database
GPG Key ID: EF51A29A50FB754C

@ -49,7 +49,9 @@ abstract class ClipboardListener {
BufferedImage bufferedImage = null;
try {
bufferedImage = ClipboardUtils.convertToBufferedImage((Image) clipboardContents.getTransferData(IMAGE.getDataFlavor()));
if (clipboardContents.isDataFlavorSupported(IMAGE.getDataFlavor())) {
bufferedImage = ClipboardUtils.convertToBufferedImage((Image) clipboardContents.getTransferData(IMAGE.getDataFlavor()));
}
} catch (UnsupportedFlavorException | IOException exp) {
exp.printStackTrace();
}

Loading…
Cancel
Save