Skip to content

Commit

Permalink
fix: make warnings nullable instead of lateinit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas authored and oSumAtrIX committed Jun 5, 2022
1 parent e608651 commit 8f1a629
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 7 additions & 3 deletions src/test/kotlin/app/revanced/patcher/PatcherTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
}
}
}
Expand Down

0 comments on commit 8f1a629

Please sign in to comment.