1
0
mirror of https://github.com/etesync/android synced 2024-12-23 07:08:16 +00:00

Don't crash when immediately entering collection after creation.

This commit is contained in:
Tom Hacohen 2017-04-26 13:37:47 +01:00
parent eae4e14b1d
commit 26c0a62dc4

View File

@ -237,6 +237,9 @@ public class ViewCollectionActivity extends AppCompatActivity implements Refresh
if (info.type == CollectionInfo.Type.CALENDAR) {
try {
LocalCalendar resource = LocalCalendar.findByName(account, getContentResolver().acquireContentProviderClient(CalendarContract.CONTENT_URI), LocalCalendar.Factory.INSTANCE, info.uid);
if (resource == null) {
return null;
}
count = resource.count();
} catch (FileNotFoundException | CalendarStorageException e) {
e.printStackTrace();
@ -245,6 +248,9 @@ public class ViewCollectionActivity extends AppCompatActivity implements Refresh
} else {
try {
LocalAddressBook resource = LocalAddressBook.findByUid(ViewCollectionActivity.this, getContentResolver().acquireContentProviderClient(ContactsContract.Contacts.CONTENT_URI), account, info.uid);
if (resource == null) {
return null;
}
count = resource.count();
} catch (ContactsStorageException e) {
e.printStackTrace();