tylerwilson
10/14/2016, 7:44 PMclass X {
var prop: HashMap<String>? = null
}
I want to do the following:
var x: X? = X()
if (x != null && x.prop != null) {
x.prop[key] = value
}
but I get an error about using x.prop. I ned to append '!!' to make it work. But if I do this:
var x: X? = X()
if (x != null) {
var prop = x.prop
if (prop != null) {
prop[key] = value
}
}
it works. It appears the compiler does not do the non-null check for members of a nullable type. Does that sound right?