1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Avoid NullPointerException for messages with html_content = NULL in DB

Fixes issue 3302
This commit is contained in:
cketti 2011-05-06 20:02:55 +02:00
parent 42bfd7d529
commit 33c0bf9e31

View File

@ -2425,16 +2425,18 @@ public class LocalStore extends Store implements Serializable {
{ Long.toString(messageId) }, null, null, null);
try {
if (cursor.moveToNext()) {
String new_html;
String htmlContent = cursor.getString(0);
new_html = cursor.getString(0);
new_html = new_html.replaceAll(Pattern.quote("cid:" + contentId),
contentUri.toString());
if (htmlContent != null) {
String newHtmlContent = htmlContent.replaceAll(
Pattern.quote("cid:" + contentId),
contentUri.toString());
ContentValues cv = new ContentValues();
cv.put("html_content", new_html);
db.update("messages", cv, "id = ?", new String[]
{ Long.toString(messageId) });
ContentValues cv = new ContentValues();
cv.put("html_content", newHtmlContent);
db.update("messages", cv, "id = ?", new String[]
{ Long.toString(messageId) });
}
}
} finally {
if (cursor != null) {