Don't call deserializers with null
This commit is contained in:
parent
ee9ffa808a
commit
f50cce6d14
|
@ -51,7 +51,11 @@ final class GsonToMiniGsonTypeAdapter implements TypeAdapter.Factory {
|
||||||
// TODO: handle if deserializer is null
|
// TODO: handle if deserializer is null
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
return deserializer.deserialize(Streams.parse(reader), typeOfT, createDeserializationContext(miniGson));
|
JsonElement value = Streams.parse(reader);
|
||||||
|
if (value.isJsonNull()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return deserializer.deserialize(value, typeOfT, createDeserializationContext(miniGson));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void write(JsonWriter writer, Object value) throws IOException {
|
public void write(JsonWriter writer, Object value) throws IOException {
|
||||||
|
|
|
@ -81,7 +81,7 @@ public abstract class JsonElement {
|
||||||
if (isJsonObject()) {
|
if (isJsonObject()) {
|
||||||
return (JsonObject) this;
|
return (JsonObject) this;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("This is not a JSON Object.");
|
throw new IllegalStateException("Not a JSON Object: " + this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user