```Log.d(TAG, descriptionResult.errorMessage.toString()) intervention.value = intervention.value?.c...
n
Copy code
Log.d(TAG, descriptionResult.errorMessage.toString())
 intervention.value = intervention.value?.copy(
  descriptionError = descriptionResult.errorMessage,
  timeError = timeResult.errorMessage
)
Log.d(TAG, "intervention: ${intervention.value?.descriptionError}")
return
đź§µ 2
l
Hello Nikolas,
intervention.value
might be null ? You can add a
?:
operator after
.copy()
handle the case when intervantion.value is null like :
Copy code
intervention.value = intervention.value?.copy(
  descriptionError = descriptionResult.errorMessage,
  timeError = timeResult.errorMessage
) ?: TODO()
d
null?.copy() is null , you must init intervention or use elvis
Copy code
( intervention.value ?: Intervation() ).copy
n
sorry, my fault, I forgot to specify: “intervention.value” is certainly not null in that part of code, i’m displaying its other attributes in the View
I found the problem: I overwrote the equals/hashcode methods of the Intervention class, but I forgot to update them after I added the “error” fields
I suppose that caused problems with the “copy” method
🙌 2