I have the following function in a Kotlin class:
private fun raiseResponse(ex: Exception, resObj: JSONObject) {
if (_activity == null || _responseHandler == null) return
_activity.runOnUiThread {
_responseHandler.invoke(ex, resObj)
}
}
Where both _activity and _responseHandler are defined as:
var _activity: Activity? = null
var _responseHandler: ((Exception, JSONObject) -> Unit)? = null
However, the line that calls runOnUiThread will only compile if I use ?. instead of ..
I've tried Google searching but I'm afraid my terminology is lacking. I assumed my null check on the first line of raiseResponse was enough to ensure that the ?. was unecessary?