Resolve a null pointer in PhoneStateChangedReceiver

pull/14/head
Sam Bosley 13 years ago
parent 7096718764
commit 03f46f4a9d

@ -59,6 +59,8 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
Calls.DATE + " DESC" Calls.DATE + " DESC"
); );
try { try {
if (calls == null)
return;
if (calls.moveToFirst()) { if (calls.moveToFirst()) {
int numberIndex = calls.getColumnIndex(Calls.NUMBER); int numberIndex = calls.getColumnIndex(Calls.NUMBER);
String number = calls.getString(numberIndex); String number = calls.getString(numberIndex);
@ -97,7 +99,8 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
context.startActivity(missedCallIntent); context.startActivity(missedCallIntent);
} }
} finally { } finally {
calls.close(); if (calls != null)
calls.close();
} }
} }
}.start(); }.start();

Loading…
Cancel
Save