I have the following code: ``` arguments?.getStrin...
# android
b
I have the following code:
Copy code
arguments?.getString(FORCED_EMAIL).let {
      binding.etEmail.setText(it)
      binding.etEmail.isFocusable = false
      binding.etEmail.isEnabled = false
    }
getString()
returns null. Anyone has an idea why this goes through and executes statements inside let?
j
let
just scopes the receiver which in this case is nullable. So your
it
will still be nullable. If you want to avoid calling the lambda for null, use
?.let
➕ 23