Fix parsing of permissions when kind is not present inside the json

This commit is contained in:
greenart7c3
2026-09-04 05:58:03 -03:00
parent cb065a3c22
commit 41a0ec3eb4
2 changed files with 3 additions and 2 deletions
@@ -49,7 +49,7 @@ data class Permission(
companion object {
fun fromJson(jsonObject: JsonNode): Permission = Permission(
type = jsonObject.get("type").asText().intern(),
kind = jsonObject.get("kind").asText()?.toIntOrNull(),
kind = jsonObject.get("kind")?.asText()?.toIntOrNull(),
)
}
}
@@ -421,7 +421,8 @@ object IntentUtils {
val permissions: MutableList<Permission>? = json?.let {
try {
Permission.mapper.readValue<MutableList<Permission>>(it)
} catch (_: Exception) {
} catch (e: Exception) {
AmberLog.e("IntentUtils", "Error parsing permissions: $json", e)
null
}
}