Prevent send crash

pull/194/merge
M66B 3 years ago
parent 4acd0e4f3a
commit 9110202e4a

@ -1325,20 +1325,24 @@ public class SMTPTransport extends Transport {
traceOutput.setReporter(total.value, new TraceOutputStream.IReport() { traceOutput.setReporter(total.value, new TraceOutputStream.IReport() {
@Override @Override
public void report(int pos, int total) { public void report(int pos, int total) {
if (reporter == null) try {
return; if (reporter == null)
return;
int q = 0;
if (fd != null) int q = 0;
q = eu.faircode.email.ConnectionHelper.jni_socket_get_send_buffer(fd); if (fd != null)
if (q > pos) q = eu.faircode.email.ConnectionHelper.jni_socket_get_send_buffer(fd);
q = pos; if (q > pos)
q = pos;
int sent = pos - q;
if (sent > total) int sent = pos - q;
sent = total; if (sent > total)
sent = total;
reporter.report(sent, total);
reporter.report(sent, total);
} catch (Throwable ex) {
eu.faircode.email.Log.e(ex);
}
} }
}); });
if (chunkSize > 0 && supportsExtension("CHUNKING")) { if (chunkSize > 0 && supportsExtension("CHUNKING")) {

Loading…
Cancel
Save