1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-03-25 06:50:09 +08:00

Ignore null values

This commit is contained in:
Him188 2020-03-01 01:41:33 +08:00
parent 9faea0a396
commit f57d0242ad

View File

@ -135,7 +135,7 @@ private fun Any.contentToStringReflectively(prefix: String, filter: ((name: Stri
.distinctBy { it.name }
.filterNot { it.name.contains("$") || it.name == "Companion" || it.isConst || it.name == "serialVersionUID" }
.mapNotNull {
val value = it.getValueAgainstPermission(this)
val value = it.getValueAgainstPermission(this) ?: return@mapNotNull null
if (filter != null) {
if (!filter(it.name, value))
return@mapNotNull it.name to value