This is the culprit. The key "notexist", has no entry and therefore testmap.Get("notexist") returns a Null. Null cannot be on the left-hand side of a comparison.
Solution 1: always put a Map's get on the right side of the comparison
If "B" = testmap.Get("notexist") Then
In this case, since "B" is a string, the compiler will cast the right side as a string. With testmap.Get("notexist") returning Null, the cast will change it to a B4X Null string, which is a String with the value "null". Since "B" <> "null", the comparison works as is.
Solution 2: Cast the get to a String
If testmap.Get("notexist").As(String) = "B" Then
Here you are telling the compiler explicitly to cast the returned Get value to a String
Solution 2 still can fail. Don't rely on the compiler to do the casting for you or use a casting, since Null, for example, does not cast to Int
If 1 = testmap.Get("notexist") Then ' Fails if Get returns Null
If 1 = testmap.Get("notexist").As(Int) Then ' Fails if Get returns Null
Solution 3: On way is to use GetDefault and make the default value a value that cannot be
If "B" = testmap.GetDefault("notexist", "AValueThatShouldNeverBe") Then
If 1 = testmap.Get("notexist", -9999999) Then
Will never fail.
Solution 4: Just test if the key exists first
If testmap.ContainsKey("notexist") Then
If "B" = testmap.Get("notexist") Then ' Note: still putting Get on right side of equality
'Do your stuff here
End If
End If
With this code, you can distinguish between the key not existing and the key not being equal to some condition. This code may still fail if what ever you get on the right side cannot be casted to the item on the left side of the equation (in the case above if testmap.Get("notexist") cannot be casted to a String).
Programming is so much fun...