Jul 30, 2017 · 1 min read
Kotlin’s null safety isn’t watertight, and I don’t think they ever claimed it was. The lesson here isn’t that Kotlin is broken, it’s that you should never trust data from external sources.
Deserialize into nullable fields, and add some validation logic. Better yet, validate when you convert from the data transfer object to your internal models (if you aren’t doing this already, you really ought to consider it).