fix rest of resource leaks (#1351)

This commit is contained in:
Vincent Breitmoser
2015-06-17 21:30:25 +02:00
parent 5895385153
commit f5aa36ef9f
7 changed files with 79 additions and 65 deletions

View File

@@ -217,13 +217,15 @@ public class AppSettingsActivity extends BaseActivity {
// show accounts only if available (deprecated API)
Cursor cursor = getContentResolver().query(accountsUri, null, null, null, null);
if (cursor.moveToFirst()) {
if (cursor != null && cursor.moveToFirst()) try {
mAccountsLabel.setVisibility(View.VISIBLE);
mAccountsListFragment = AccountsListFragment.newInstance(accountsUri);
// Create an instance of the fragments
getSupportFragmentManager().beginTransaction()
.replace(R.id.api_accounts_list_fragment, mAccountsListFragment)
.commitAllowingStateLoss();
} finally {
cursor.close();
}
// Create an instance of the fragments