fix: make warnings nullable instead of lateinit

This commit is contained in:
Lucaskyy 2022-04-14 19:26:43 +02:00 committed by oSumAtrIX
parent e6086511e5
commit 8f1a629191
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
2 changed files with 8 additions and 4 deletions

View file

@ -88,7 +88,7 @@ interface PatternScanMethod {
* or the signature was not yet resolved,
* the list will be null.
*/
lateinit var warnings: List<Warning>
var warnings: List<Warning>? = null
/**
* Represents a resolver warning.

View file

@ -18,9 +18,13 @@ internal class PatcherTest {
val patternScanMethod = signature.metadata.patternScanMethod
if (patternScanMethod is PatternScanMethod.Fuzzy) {
val warnings = patternScanMethod.warnings
println("Signature ${signature.metadata.name} had ${warnings.size} warnings!")
for (warning in warnings) {
println(warning.toString())
if (warnings != null) {
println("Signature ${signature.metadata.name} had ${warnings.size} warnings!")
for (warning in warnings) {
println(warning.toString())
}
} else {
println("Signature ${signature.metadata.name} used the fuzzy resolver, but the warnings list is null!")
}
}
}