diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java index 407369595..620d135d0 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksListService.java @@ -101,7 +101,7 @@ public class GtasksListService { public StoreObject getList(String listId) { readLists(); for(StoreObject list : lists) - if(list.getValue(GtasksList.REMOTE_ID).equals(listId)) + if(list != null && list.getValue(GtasksList.REMOTE_ID).equals(listId)) return list; return LIST_NOT_FOUND_OBJECT; } diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java index dbe13d0e9..27fcbad0f 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java @@ -416,6 +416,9 @@ public final class ReminderService { */ @SuppressWarnings("nls") public void createAlarm(Task task, long time, int type) { + if(task.getId() == Task.NO_ID) + return; + Context context = ContextManager.getContext(); Intent intent = new Intent(context, Notifications.class); intent.setType(Long.toString(task.getId())); @@ -425,9 +428,15 @@ public final class ReminderService { // calculate the unique requestCode as a combination of the task-id and alarm-type: // concatenate id+type to keep the combo unique - String rc = ""+task.getId()+type; + String rc = String.format("%d%d", task.getId(), type); + int requestCode; + try { + requestCode = Integer.parseInt(rc); + } catch (Exception e) { + requestCode = type; + } AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); - PendingIntent pendingIntent = PendingIntent.getBroadcast(context, Integer.parseInt(rc), + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, 0); if (time == 0 || time == NO_ALARM)