mirror of
https://github.com/moparisthebest/k-9
synced 2025-03-10 06:20:24 -04:00
Avoid NullPointerException for messages with html_content = NULL in DB
Fixes issue 3302
This commit is contained in:
parent
fb719d5b78
commit
be6299fbf1
@ -2425,16 +2425,18 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
{ Long.toString(messageId) }, null, null, null);
|
{ Long.toString(messageId) }, null, null, null);
|
||||||
try {
|
try {
|
||||||
if (cursor.moveToNext()) {
|
if (cursor.moveToNext()) {
|
||||||
String new_html;
|
String htmlContent = cursor.getString(0);
|
||||||
|
|
||||||
new_html = cursor.getString(0);
|
if (htmlContent != null) {
|
||||||
new_html = new_html.replaceAll(Pattern.quote("cid:" + contentId),
|
String newHtmlContent = htmlContent.replaceAll(
|
||||||
contentUri.toString());
|
Pattern.quote("cid:" + contentId),
|
||||||
|
contentUri.toString());
|
||||||
|
|
||||||
ContentValues cv = new ContentValues();
|
ContentValues cv = new ContentValues();
|
||||||
cv.put("html_content", new_html);
|
cv.put("html_content", newHtmlContent);
|
||||||
db.update("messages", cv, "id = ?", new String[]
|
db.update("messages", cv, "id = ?", new String[]
|
||||||
{ Long.toString(messageId) });
|
{ Long.toString(messageId) });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user