mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Fixed NullPointerException when trying to send message with to text body (attachment only for example). The message would end up being stuck in the outbox.
This commit is contained in:
parent
f64de34d2f
commit
93b95b85b2
@ -20,9 +20,11 @@ public class TextBody implements Body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writeTo(OutputStream out) throws IOException, MessagingException {
|
public void writeTo(OutputStream out) throws IOException, MessagingException {
|
||||||
|
if (mBody!=null) {
|
||||||
byte[] bytes = mBody.getBytes("UTF-8");
|
byte[] bytes = mBody.getBytes("UTF-8");
|
||||||
out.write(Base64.encodeBase64Chunked(bytes));
|
out.write(Base64.encodeBase64Chunked(bytes));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the text of the body in it's unencoded format.
|
* Get the text of the body in it's unencoded format.
|
||||||
@ -37,7 +39,13 @@ public class TextBody implements Body {
|
|||||||
*/
|
*/
|
||||||
public InputStream getInputStream() throws MessagingException {
|
public InputStream getInputStream() throws MessagingException {
|
||||||
try {
|
try {
|
||||||
byte[] b = mBody.getBytes("UTF-8");
|
byte[] b;
|
||||||
|
if (mBody!=null) {
|
||||||
|
b = mBody.getBytes("UTF-8");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
b = new byte[0];
|
||||||
|
}
|
||||||
return new ByteArrayInputStream(b);
|
return new ByteArrayInputStream(b);
|
||||||
}
|
}
|
||||||
catch (UnsupportedEncodingException usee) {
|
catch (UnsupportedEncodingException usee) {
|
||||||
|
Loading…
Reference in New Issue
Block a user