Skip to content

Commit

Permalink
fix: add null check when loading data from manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench committed Apr 29, 2020
1 parent d742a76 commit 130c4cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
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

0 comments on commit 130c4cf

Please sign in to comment.