Fix for crashes reported from android market

pull/14/head
Tim Su 13 years ago
parent a92bef662b
commit 0aa6bc1260

@ -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;
}

@ -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)

Loading…
Cancel
Save