getOrNull

abstract fun <T : Any> getOrNull(key: AttributeKey<T>): T?

Gets a value of the attribute for the specified key, or return null if an attribute doesn’t exist