Null safe equals

How do I make a null safe equals comparison?

This is not valid Kotlin code:

val map: Map<String, JsonElement>?

if (map?["some_key"]? == "some_value") { ... }

How do I write that correctly? If map is null or the key isn’t in it then the == should evaluate to false.

It was just the bracket syntax that didn’t play well with the null-safe operator.

This is valid:

if (map?.get("some_key") == "some_value") { ... }