Skip to content

Commit b14c7bf

Browse files
Avoid reading floats as ints from the manifest in case it's not necessary (#4266)
* Avoid logging an error when a float is passed in the manifest * Update CHANGELOG.md --------- Co-authored-by: Stefano <[email protected]>
1 parent b326f55 commit b14c7bf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Avoid logging an error when a float is passed in the manifest ([#4266](https://github.com/getsentry/sentry-java/pull/4266))
8+
39
## 7.22.3
410

511
### Fixes

sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,10 @@ private static boolean readBool(
494494
private static @NotNull Double readDouble(
495495
final @NotNull Bundle metadata, final @NotNull ILogger logger, final @NotNull String key) {
496496
// manifest meta-data only reads float
497-
final Double value = ((Number) metadata.getFloat(key, metadata.getInt(key, -1))).doubleValue();
497+
double value = ((Float) metadata.getFloat(key, -1)).doubleValue();
498+
if (value == -1) {
499+
value = ((Integer) metadata.getInt(key, -1)).doubleValue();
500+
}
498501
logger.log(SentryLevel.DEBUG, key + " read: " + value);
499502
return value;
500503
}

0 commit comments

Comments
 (0)