Catch securtiy exception if contacts can't be read on Android 6.0. Closes #182

master
Andreas Shimokawa 2015-12-06 15:29:57 +01:00
parent a8db606240
commit 112dfa184a
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,8 @@
###Changelog
####Next Version
* Fix crash when contacts cannot be read on Android 6.0 (non-granted pemissions)
####Version 0.6.7
* Pebble: Allow installation of 3.x apps on OG Pebble (FW will be released soon)
* Fix crashes on startup when logging is enabled or when entering the app manager on some phones

View File

@ -430,7 +430,13 @@ public class DeviceCommunicationService extends Service {
}
ContentResolver contentResolver = getContentResolver();
Cursor contactLookup = contentResolver.query(uri, null, null, null, null);
Cursor contactLookup = null;
try {
contentResolver.query(uri, null, null, null, null);
} catch (SecurityException e) {
return name;
}
try {
if (contactLookup != null && contactLookup.getCount() > 0) {