Skip to content

Commit 0ceaa48

Browse files
Merge pull request #848 from DataDog/marcosaia/fix/initial-resource-threshold-error
[FIX] Android: Fix runtime error caused by initialResourceThreshold
2 parents 1f3d75a + 59cd494 commit 0ceaa48

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkBridgeExt.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,15 @@ internal fun ReadableMap.getBooleanOrNull(key: String): Boolean? {
230230
null
231231
}
232232
}
233+
234+
/**
235+
* Returns the double for the given key, or null if the entry is
236+
* not in the map.
237+
*/
238+
internal fun ReadableMap.getDoubleOrNull(key: String): Double? {
239+
return if (hasKey(key)) {
240+
getDouble(key)
241+
} else {
242+
null
243+
}
244+
}

packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal fun ReadableMap.asDdSdkConfiguration(): DdSdkConfiguration {
4949
bundleLogsWithTraces = getBoolean("bundleLogsWithTraces"),
5050
trackNonFatalAnrs = getBooleanOrNull("trackNonFatalAnrs"),
5151
batchProcessingLevel = getString("batchProcessingLevel"),
52-
initialResourceThreshold = getDouble("initialResourceThreshold")
52+
initialResourceThreshold = getDoubleOrNull("initialResourceThreshold")
5353
)
5454
}
5555

0 commit comments

Comments
 (0)