From c18cc937b0fd856201e3bf3c1ae50210b91e4dad Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Mon, 5 Nov 2012 10:41:53 -0800 Subject: [PATCH] Catch a runtime exception ('System server dead') the system would sometimes throw in the widget --- .../src/com/todoroo/astrid/widget/TasksWidget.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java index 06efd6a88..ebb956f36 100644 --- a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java +++ b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java @@ -140,9 +140,15 @@ public class TasksWidget extends AppWidgetProvider { if(intent != null) extrasId = intent.getIntExtra(EXTRA_WIDGET_ID, extrasId); if(extrasId == AppWidgetManager.INVALID_APPWIDGET_ID) { - for(int id : manager.getAppWidgetIds(thisWidget)) { - RemoteViews updateViews = buildUpdate(this, id); - manager.updateAppWidget(id, updateViews); + int[] ids; + try { + ids = manager.getAppWidgetIds(thisWidget); + for(int id : ids) { + RemoteViews updateViews = buildUpdate(this, id); + manager.updateAppWidget(id, updateViews); + } + } catch (RuntimeException e) { + // "System server dead" was sometimes thrown here by the OS. Abort if that happens } } else { int id = extrasId;