From 5da73140a5e1ca4e857ee0f9e387b88c03e5f0f0 Mon Sep 17 00:00:00 2001 From: srowen Date: Tue, 25 Sep 2012 21:07:16 +0000 Subject: [PATCH] Fix minor NPE on item detail update git-svn-id: https://zxing.googlecode.com/svn/trunk@2411 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../zxing/client/android/history/HistoryManager.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/android/src/com/google/zxing/client/android/history/HistoryManager.java b/android/src/com/google/zxing/client/android/history/HistoryManager.java index aa636d298..198a06adb 100644 --- a/android/src/com/google/zxing/client/android/history/HistoryManager.java +++ b/android/src/com/google/zxing/client/android/history/HistoryManager.java @@ -203,11 +203,12 @@ public final class HistoryManager { oldDetails = cursor.getString(1); } - String newDetails = oldDetails == null ? itemDetails : oldDetails + " : " + itemDetails; - ContentValues values = new ContentValues(); - values.put(DBHelper.DETAILS_COL, newDetails); - - db.update(DBHelper.TABLE_NAME, values, DBHelper.ID_COL + "=?", new String[] { oldID }); + if (oldID != null) { + String newDetails = oldDetails == null ? itemDetails : oldDetails + " : " + itemDetails; + ContentValues values = new ContentValues(); + values.put(DBHelper.DETAILS_COL, newDetails); + db.update(DBHelper.TABLE_NAME, values, DBHelper.ID_COL + "=?", new String[] { oldID }); + } } finally { close(cursor, db);