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 { // 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: element without name attribute" + } val className = requireNotNull(field.getParentNode()) { "Bad XML: top level element" } .getAttribute("name")