Fix out of bounds exception when pasting an empty selection

This commit is contained in:
crschnick 2023-07-09 04:03:59 +00:00
parent 2af3e33097
commit 6868f6567b
2 changed files with 9 additions and 0 deletions

View file

@ -236,6 +236,11 @@ public final class OpenFileSystemModel {
public void dropFilesIntoAsync(
FileSystem.FileEntry target, List<FileSystem.FileEntry> files, boolean explicitCopy) {
// We don't have to do anything in this case
if (files.isEmpty()) {
return;
}
ThreadHelper.runFailableAsync(() -> {
BusyProperty.execute(busy, () -> {
if (fileSystem == null) {

View file

@ -26,6 +26,10 @@ public class PasteAction implements LeafAction {
? entries.get(0).getRawFileEntry()
: model.getCurrentDirectory();
var files = clipboard.getEntries();
if (files.size() == 0) {
return;
}
model.dropFilesIntoAsync(target, files, true);
}