
It’s not “well-behaved.” And yet, it was working fine up till now. How does Gson handle poorly-behaved classes?īut this data class doesn’t have a no-args constructor.

And, indeed, the corresponding field proved to be missing from the API response.īut why did this not error out at that point? How did an Invitation ever get created with a null placeName property in the first place? Kotlin told us that would be impossible, but exception logging doesn’t lie.

So the bogus data probably came from there.

How does a not-null property wind up null? The exception that shouldn’t have been possible had left the database locked, and ultimately, the app had crashed. While I might personally prefer sticking with null-safe calls and elvis operators, it sounds like you'd prefer cleaner code at the call site (especially considering you know these keys exist and have associated non-null values).E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-2Ī: database is locked (code 5): retrycount exceeded MapOf() is providing a Map with no guarantees for the presence of a key- something which is kind of expected especially considering the Java implementation of Map.
