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:
parent
87023ebdb3
commit
7e8281e8d4
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user