Make generated adapters null-safe.

This is in alignment with the lookup for Java and Kotlin reflective adapters.
This commit is contained in:
Eric Cochran
2018-09-10 16:31:24 -07:00
parent d1c2cf9c6c
commit e7c745aac8
3 changed files with 20 additions and 5 deletions

View File

@@ -59,7 +59,7 @@ final class StandardJsonAdapters {
JsonClass jsonClass = rawType.getAnnotation(JsonClass.class);
if (jsonClass != null && jsonClass.generateAdapter()) {
return generatedAdapter(moshi, type, rawType);
return generatedAdapter(moshi, type, rawType).nullSafe();
}
if (rawType.isEnum()) {