Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScanHelper Moving NPE exception above RuntimeException #824

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,7 @@

### Development

- Fix intermittent crash caused by internal Android NPE (#824, kababu007)
- Update gradle and robolectric (#805, Tony Tang)
- Fix problem on service shutdown that leaked threads and left scanning on (#804, David G. Young)

Expand Down
12 changes: 10 additions & 2 deletions lib/src/main/java/org/altbeacon/beacon/service/ScanHelper.java
Expand Up @@ -208,9 +208,14 @@ void startAndroidOBackgroundScan(Set<BeaconParser> beaconParsers) {
LogManager.e(TAG, "Failed to start background scan on Android O: scanner is null");
}
}
}
catch (SecurityException e) {
} catch (SecurityException e) {
LogManager.e(TAG, "SecurityException making Android O background scanner");
} catch (NullPointerException e) {
// Needed to stop a crash caused by internal NPE thrown by Android. See issue #636
LogManager.e(TAG, "NullPointerException starting Android O background scanner", e);
} catch (RuntimeException e) {
// Needed to stop a crash caused by internal Android throw. See issue #701
LogManager.e(TAG, "Unexpected runtime exception starting Android O background scanner", e);
}
}

Expand All @@ -232,6 +237,9 @@ void stopAndroidOBackgroundScan() {
}
} catch (SecurityException e) {
LogManager.e(TAG, "SecurityException stopping Android O background scanner");
} catch (NullPointerException e) {
// Needed to stop a crash caused by internal NPE thrown by Android. See issue #636
LogManager.e(TAG, "NullPointerException stopping Android O background scanner", e);
} catch (RuntimeException e) {
// Needed to stop a crash caused by internal Android throw. See issue #701
LogManager.e(TAG, "Unexpected runtime exception stopping Android O background scanner", e);
Expand Down