aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMårten Kongstad <amhk@google.com>2024-04-26 05:39:03 +0200
committerMårten Kongstad <amhk@google.com>2024-04-26 05:39:03 +0200
commit04e4564f49eeeafd601ce3320a9cb8a8db659633 (patch)
tree6e93f12977beaf8e377f8cf3c7eeee0be23f7610
parent68d63d47afa38b97a761e157110ecd95c76aeab9 (diff)
downloadbuild-04e4564f49eeeafd601ce3320a9cb8a8db659633.tar.gz
check-flagged-apis: add missing requireNotNull
Bug: 334870672 Test: atest --host check-flagged-apis-test Change-Id: Ibffafb504240c82d525105d4678983b30b70592d
-rw-r--r--tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
index 84564ba34c..c4c5b1168b 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
@@ -207,7 +207,10 @@ internal fun parseApiVersions(input: InputStream): Set<Symbol> {
// ktfmt doesn't understand the `..<` range syntax; explicitly call .rangeUntil instead
for (i in 0.rangeUntil(fields.getLength())) {
val field = fields.item(i)
- val fieldName = field.getAttribute("name")
+ val fieldName =
+ requireNotNull(field.getAttribute("name")) {
+ "Bad XML: <field> element without name attribute"
+ }
val className =
requireNotNull(field.getParentNode()) { "Bad XML: top level <field> element" }
.getAttribute("name")