Fix NPE while encoding when favicon was missing
This commit is contained in:
parent
e2eba52162
commit
994a996981
@ -14,6 +14,7 @@ import java.io.InputStream;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,13 +29,14 @@ public class Favicon
|
|||||||
@Override
|
@Override
|
||||||
public void write(JsonWriter out, Favicon value) throws IOException
|
public void write(JsonWriter out, Favicon value) throws IOException
|
||||||
{
|
{
|
||||||
TypeAdapters.STRING.write( out, value.getEncoded() );
|
TypeAdapters.STRING.write( out, value == null ? null : value.getEncoded() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Favicon read(JsonReader in) throws IOException
|
public Favicon read(JsonReader in) throws IOException
|
||||||
{
|
{
|
||||||
return create( TypeAdapters.STRING.read( in ) );
|
String enc = TypeAdapters.STRING.read( in );
|
||||||
|
return enc == null ? null : create( enc );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ public class Favicon
|
|||||||
/**
|
/**
|
||||||
* The base64 encoded favicon, including MIME header.
|
* The base64 encoded favicon, including MIME header.
|
||||||
*/
|
*/
|
||||||
|
@NonNull
|
||||||
@Getter
|
@Getter
|
||||||
private final String encoded;
|
private final String encoded;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user