https://kotlinlang.org logo
s

Scott

11/18/2017, 8:03 PM
Yea, the safe call is the way to go. It's basically the same as an if statement that checks for null before proceeding. If you use !! then it just charges ahead and hopes for the best. When I'm writing new stuff I never allow any nulls and always put something, anything, in there... unless I'm checking an array length or something similar where you just can't prevent the possibility of a null.