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

Add null check when loading data from manifest #878

Merged
merged 1 commit into from
Apr 30, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## TBD

### Bug fixes

* Add null check when loading data from manifest
[#878](https://github.com/bugsnag/bugsnag-android/pull/878)

## 5.0.0 (2020-04-21)

__This version contains many breaking changes__. It is part of an effort to unify our notifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,23 @@ internal class ManifestConfigLoader {
* @param data the manifest bundle
*/
@VisibleForTesting
internal fun load(data: Bundle, userSuppliedApiKey: String?): Configuration {
internal fun load(data: Bundle?, userSuppliedApiKey: String?): Configuration {
// get the api key from the JVM call, or lookup in the manifest if null
val apiKey = (userSuppliedApiKey ?: data.getString(API_KEY))
val apiKey = (userSuppliedApiKey ?: data?.getString(API_KEY))
?: throw IllegalArgumentException("No Bugsnag API key set")
val config = Configuration(apiKey)

loadDetectionConfig(config, data)
loadEndpointsConfig(config, data)
loadAppConfig(config, data)
if (data != null) {
loadDetectionConfig(config, data)
loadEndpointsConfig(config, data)
loadAppConfig(config, data)

// misc config
with(config) {
maxBreadcrumbs = data.getInt(MAX_BREADCRUMBS, maxBreadcrumbs)
launchCrashThresholdMs =
data.getInt(LAUNCH_CRASH_THRESHOLD_MS, launchCrashThresholdMs.toInt()).toLong()
// misc config
with(config) {
maxBreadcrumbs = data.getInt(MAX_BREADCRUMBS, maxBreadcrumbs)
launchCrashThresholdMs =
data.getInt(LAUNCH_CRASH_THRESHOLD_MS, launchCrashThresholdMs.toInt()).toLong()
}
}
return config
}
Expand Down