Skip to content

Commit 96a61bf

Browse files
committed
fix(admob): fix out of range parsing
1 parent 6cc5b47 commit 96a61bf

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/firebase-admob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/firebase-admob",
3-
"version": "1.0.0-alpha.17",
3+
"version": "1.0.0-alpha.18",
44
"description": "NativeScript Firebase - Admob",
55
"main": "index",
66
"typings": "index.d.ts",
Binary file not shown.

packages/firebase-admob/src-native/android/admob/src/main/java/org/nativescript/firebase/admob/FirebaseAdmob.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class FirebaseAdmob {
419419

420420
config.optJSONArray(AD_SIZES_KEY)?.let {
421421
val sizes = mutableListOf<AdSize>()
422-
for (i in 0..it.length()) {
422+
for (i in 0 until it.length()) {
423423
sizes.add(BannerAdSize.fromString(it.getString(i)).toAdSize())
424424
}
425425
adLoader.forAdManagerAdView({ view ->
@@ -573,7 +573,7 @@ class FirebaseAdmob {
573573
}
574574

575575
debugSettings.optJSONArray(DEVICE_IDS_KEY)?.let { deviceIds ->
576-
for (i in 0..deviceIds.length()) {
576+
for (i in 0 until deviceIds.length()) {
577577
val deviceId = deviceIds.getString(i)
578578
if (deviceId == EMULATOR_KEY) {
579579
debug.addTestDeviceHashedId(AdRequest.DEVICE_ID_EMULATOR)
@@ -740,7 +740,7 @@ class FirebaseAdmob {
740740

741741
config.optJSONArray(RequestConfiguration.TestDevices.toString())?.let { testDevices ->
742742
val list = mutableListOf<String>()
743-
for (i in 0..testDevices.length()) {
743+
for (i in 0 until testDevices.length()) {
744744
val value = testDevices.getString(i)
745745
if (value == "EMULATOR") {
746746
list.add(AdRequest.DEVICE_ID_EMULATOR)
@@ -772,7 +772,7 @@ class FirebaseAdmob {
772772
}
773773

774774
json.optJSONArray(KEYWORDS_KEY)?.let {
775-
for (i in 0..it.length()) {
775+
for (i in 0 until it.length()) {
776776
adRequest.addKeyword(it.getString(i))
777777
}
778778
}
@@ -834,7 +834,7 @@ class FirebaseAdmob {
834834
when (val value = it[key]) {
835835
is JSONArray -> {
836836
val list = mutableListOf<String>()
837-
for (i in 0..value.length()) {
837+
for (i in 0 until value.length()) {
838838
list.add(value.getString(i))
839839
}
840840
adRequest.addCustomTargeting(key, list)
@@ -847,7 +847,7 @@ class FirebaseAdmob {
847847
}
848848

849849
json.optJSONArray(CATEGORY_EXCLUSIONS_KEY)?.let {
850-
for (i in 0..it.length()) {
850+
for (i in 0 until it.length()) {
851851
adRequest.addCategoryExclusion(it.getString(i))
852852
}
853853
}

0 commit comments

Comments
 (0)