1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Improve exception handling logic a bit

This commit is contained in:
cpfeiffer 2016-03-08 21:32:35 +01:00
parent 87023ebdb3
commit 7e8281e8d4

View File

@ -479,15 +479,12 @@ public class DeviceCommunicationService extends Service {
Cursor contactLookup = null;
try {
contactLookup = contentResolver.query(uri, null, null, null, null);
} catch (SecurityException e) {
return name;
}
try {
if (contactLookup != null && contactLookup.getCount() > 0) {
contactLookup.moveToNext();
name = contactLookup.getString(contactLookup.getColumnIndex(ContactsContract.Data.DISPLAY_NAME));
}
} catch (SecurityException e) {
// ignore, just return name below
} finally {
if (contactLookup != null) {
contactLookup.close();