Skip to content

Commit

Permalink
Do not save large clipboard strings in clipboard reader
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjabrain1 committed Sep 12, 2024
1 parent e2f87ab commit 6c292c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/ninjabrainbot/io/ClipboardReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ public void run() {
}
String clipboardString = null;
try {
if (read)
clipboardString = (String) clipboard.getData(DataFlavor.stringFlavor);
if (read) {
clipboardString = ((String) clipboard.getData(DataFlavor.stringFlavor));
if (clipboardString.length() > 1000)
clipboardString = clipboardString.substring(0, 1000);
}
} catch (UnsupportedFlavorException | IllegalStateException | IOException ignored) {
}
if (clipboardString != null && !lastClipboardString.equals(clipboardString)) {
Expand Down

0 comments on commit 6c292c7

Please sign in to comment.