Tweaks to update message parsing, catch activity not found errors in case the messages were badly formed

pull/14/head
Sam Bosley 13 years ago
parent 986d6e04e6
commit 30ed47ef5b

@ -212,9 +212,9 @@ public class UpdateMessageService {
private ClickableSpan getClickableSpanForUpdate(JSONObject update, String type) { private ClickableSpan getClickableSpanForUpdate(JSONObject update, String type) {
if ("pref".equals(type)) { if ("pref".equals(type)) {
try { try {
if (!update.has("prefs")) if (!update.has("action_list"))
return null; return null;
JSONArray prefSpec = update.getJSONArray("prefs"); JSONArray prefSpec = update.getJSONArray("action_list");
if (prefSpec.length() == 0) if (prefSpec.length() == 0)
return null; return null;
final String prefArray = prefSpec.toString(); final String prefArray = prefSpec.toString();
@ -231,9 +231,9 @@ public class UpdateMessageService {
} }
} else if ("screen".equals(type)) { } else if ("screen".equals(type)) {
try { try {
if (!update.has("screens")) if (!update.has("action_list"))
return null; return null;
JSONArray screens = update.getJSONArray("screens"); JSONArray screens = update.getJSONArray("action_list");
if (screens.length() == 0) if (screens.length() == 0)
return null; return null;
final ArrayList<String> screenList = new ArrayList<String>(); final ArrayList<String> screenList = new ArrayList<String>();

@ -3,6 +3,7 @@ package com.todoroo.astrid.service;
import java.util.ArrayList; import java.util.ArrayList;
import android.app.Activity; import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
@ -49,6 +50,9 @@ public class UpdateScreenFlow extends Activity {
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
finish(); finish();
} catch (ActivityNotFoundException e) {
e.printStackTrace();
finish();
} }
} }

Loading…
Cancel
Save