From 070972f72b7340b3ad0d81ab3ff25be5712a233c Mon Sep 17 00:00:00 2001 From: Tim Su Date: Mon, 18 Jul 2011 20:26:54 -0700 Subject: [PATCH] Fix for crashes reported from android market --- .../todoroo/astrid/actfm/sync/ActFmSyncService.java | 2 +- .../com/todoroo/astrid/activity/TaskEditActivity.java | 5 +++-- .../com/todoroo/astrid/activity/TaskListActivity.java | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index a5bd69cec..01553cb94 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -286,7 +286,7 @@ public final class ActFmSyncService { */ public void pushTagDataOnSave(TagData tagData, ContentValues values) { long remoteId; - if(tagData.containsValue(TagData.REMOTE_ID)) + if(tagData.containsNonNullValue(TagData.REMOTE_ID)) remoteId = tagData.getValue(TagData.REMOTE_ID); else { TagData forRemote = tagDataService.fetchById(tagData.getId(), TagData.REMOTE_ID); diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java index 7fc81e068..65ebe82fc 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java @@ -258,8 +258,9 @@ public final class TaskEditActivity extends TabActivity { public void onTabChanged(String tabId) { for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) tabHost.getTabWidget().getChildAt(i).setBackgroundResource(0); - tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()) - .setBackgroundColor(r.getColor(R.color.task_edit_selected)); + View child = tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()); + if(child != null) + child.setBackgroundColor(r.getColor(R.color.task_edit_selected)); } }; tabChange.onTabChanged(null); diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index a41f3acf6..8c3a48ea6 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -497,9 +497,13 @@ public class TaskListActivity extends ListActivity implements OnScrollListener, protected void onPause() { StatisticsService.sessionPause(); super.onPause(); - unregisterReceiver(detailReceiver); - unregisterReceiver(refreshReceiver); - unregisterReceiver(syncActionReceiver); + try { + unregisterReceiver(detailReceiver); + unregisterReceiver(refreshReceiver); + unregisterReceiver(syncActionReceiver); + } catch (IllegalArgumentException e) { + // might not have fully initialized + } backgroundTimer.cancel(); }