Permalink
Browse files

Fixed crashes reported from Android Market

  • Loading branch information...
timsu committed Apr 26, 2011
1 parent 9b3abfc commit 4ed26c0d7dc547a40cd13132b906a20c0229ac7f
@@ -142,7 +142,11 @@ protected synchronized void readPropertiesFromCursor(TodorooCursor<? extends Abs
setValues = null;
for (Property<?> property : cursor.getProperties()) {
- saver.save(property, values, cursor.get(property));
+ try {
+ saver.save(property, values, cursor.get(property));
+ } catch (IllegalArgumentException e) {
+ // underlying cursor may have changed, suppress
+ }
}
}
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid"
- android:versionName="3.7.3-rc1"
+ android:versionName="3.7.3"
android:versionCode="175">
<!-- widgets, alarms, and services will break if Astrid is installed on SD card -->
@@ -177,7 +177,7 @@ private void serializeTasks() throws IOException {
}
}
- private void serializeMetadata(Task task) throws IOException {
+ private synchronized void serializeMetadata(Task task) throws IOException {
TodorooCursor<Metadata> cursor = metadataService.query(Query.select(
Metadata.PROPERTIES).where(MetadataCriteria.byTask(task.getId())));
try {
@@ -5,8 +5,8 @@
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.utility.DateUtilities;
-import com.todoroo.astrid.data.Metadata;
import com.todoroo.andlib.utility.Preferences;
+import com.todoroo.astrid.data.Metadata;
/**
* Metadata entries for a GTasks Task
@@ -49,7 +49,7 @@ public static Metadata createEmptyMetadata(long taskId) {
String defaultList = Preferences.getStringValue(GtasksPreferenceService.PREF_DEFAULT_LIST);
if(defaultList == null)
- throw new NullPointerException("No default list has been set."); //$NON-NLS-1$
+ defaultList = ""; //$NON-NLS-1$
metadata.setValue(LIST_ID, defaultList);
metadata.setValue(PARENT_TASK, (long)VALUE_UNSET);
@@ -101,6 +101,8 @@ public boolean save(Task item) {
*/
public Task clone(Task task) {
Task newTask = fetchById(task.getId(), Task.PROPERTIES);
+ if(newTask == null)
+ return new Task();
newTask.clearValue(Task.ID);
taskDao.createNew(newTask);
TodorooCursor<Metadata> cursor = metadataDao.query(
@@ -374,7 +374,7 @@ private void performClick(int x, int y) {
currentHighlightDay = calendar.get(Calendar.DATE);
this.invalidate();
// Handle left-right arrow click -- end
- } else {
+ } else if(dayLeftArr != null) {
// Check if clicked on date
for (int i=0; i<dayLeftArr.length; i++) {
if ((x > dayLeftArr[i] && x < dayLeftArr[i]+boxWidth) && (y > dayTopArr[i] && y < dayTopArr[i] + boxHeight)) {

0 comments on commit 4ed26c0

Please sign in to comment.