[FIR] Fix default message test failing with NPE

Return early. Otherwise, if map doesn't contain the key,
`get(factory)!!` in the next statement fails with an NPE.
This commit is contained in:
Svyatoslav Kuzmich
2023-11-15 12:31:12 +01:00
committed by Space Team
parent 531e4fb86e
commit 83aa014d81
@@ -35,6 +35,7 @@ private val messageParameterRegex = """\{\d.*?}""".toRegex()
fun KtDiagnosticFactoryToRendererMap.verifyMessageForFactory(factory: AbstractKtDiagnosticFactory, property: KProperty<*>) = buildList {
if (!containsKey(factory)) {
add("No default diagnostic renderer is provided for ${property.name}")
return@buildList
}
val renderer = get(factory)!!