Merge "NPE check in the SyncStateContract BUG:5196483"

This commit is contained in:
Subir Jhanb
2011-09-09 10:36:09 -07:00
committed by Android (Google) Code Review

View File

@@ -74,6 +74,12 @@ public class SyncStateContract {
Account account) throws RemoteException {
Cursor c = provider.query(uri, DATA_PROJECTION, SELECT_BY_ACCOUNT,
new String[]{account.name, account.type}, null);
// Unable to query the provider
if (c == null) {
throw new RemoteException();
}
try {
if (c.moveToNext()) {
return c.getBlob(c.getColumnIndexOrThrow(Columns.DATA));
@@ -123,6 +129,11 @@ public class SyncStateContract {
Account account) throws RemoteException {
Cursor c = provider.query(uri, DATA_PROJECTION, SELECT_BY_ACCOUNT,
new String[]{account.name, account.type}, null);
if (c == null) {
throw new RemoteException();
}
try {
if (c.moveToNext()) {
long rowId = c.getLong(1);