From 7e8281e8d49225d14aaf138ce55888caa6595e47 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Tue, 8 Mar 2016 21:32:35 +0100 Subject: [PATCH] Improve exception handling logic a bit --- .../gadgetbridge/service/DeviceCommunicationService.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index f3b8c58b..0eddd504 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -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();