Fix file not being sent

This commit is contained in:
Yohan Simard 2021-01-06 10:43:42 +01:00
parent 43ccfe5901
commit 5f0d2ea7b1

View file

@ -15,6 +15,7 @@ public class FileMessage extends Message {
private final String fileName;
private String path;
byte[] rawFile = null;
/**
* Constructs a FileMessage
@ -84,8 +85,10 @@ public class FileMessage extends Message {
}
// write to the file
FileInputStream stream = new FileInputStream(fileName);
byte[] rawFile = stream.readAllBytes();
if (rawFile == null) {
FileInputStream stream = new FileInputStream(fileName);
rawFile = stream.readAllBytes();
}
FileOutputStream ostream = new FileOutputStream(file);
ostream.write(rawFile);