Fix progress being wrong in some cases

This commit is contained in:
crschnick 2024-03-02 13:23:40 +00:00
parent d60fff969b
commit bda50dba72
2 changed files with 3 additions and 3 deletions

View file

@ -152,14 +152,13 @@ public class BrowserTransferModel {
this.name = name; this.name = name;
this.fileEntry = fileEntry; this.fileEntry = fileEntry;
this.localFile = localFile; this.localFile = localFile;
this.progress = this.progress = new SimpleObjectProperty<>();
new SimpleObjectProperty<>(BrowserTransferProgress.empty(fileEntry.getName(), fileEntry.getSize()));
} }
public ObservableBooleanValue downloadFinished() { public ObservableBooleanValue downloadFinished() {
return Bindings.createBooleanBinding( return Bindings.createBooleanBinding(
() -> { () -> {
return progress.getValue().done(); return progress.getValue() != null && progress.getValue().done();
}, },
progress); progress);
} }

View file

@ -335,6 +335,7 @@ public class FileSystemHelper {
throw ex; throw ex;
} }
progress.accept(BrowserTransferProgress.finished(sourceFile.getName(), transferred.get()));
Exception exception = null; Exception exception = null;
try { try {
inputStream.close(); inputStream.close();