mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-14 06:16:46 +01:00
Handle null images
This commit is contained in:
parent
bf8d5eb6cf
commit
082878aade
@ -101,7 +101,8 @@ public class AWSS3MapStorage extends MapStorage {
|
||||
GetObjectResponse rsp = obj.getResponse();
|
||||
TileRead tr = new TileRead();
|
||||
byte[] buf = obj.getBytes();
|
||||
tr.image = new BufferInputStream(buf);
|
||||
if (buf == null) { return null; }
|
||||
tr.image = new BufferInputStream(buf);
|
||||
tr.format = ImageEncoding.fromContentType(rsp.getContentType());
|
||||
Map<String, String> meta = rsp.getMetadata();
|
||||
String v = meta.get("x-dynmap-hash");
|
||||
|
@ -132,7 +132,11 @@ public class MicrosoftSQLMapStorage extends MapStorage {
|
||||
rslt.lastModified = rs.getLong("LastUpdate");
|
||||
rslt.format = MapType.ImageEncoding.fromOrd(rs.getInt("Format"));
|
||||
byte[] img = rs.getBytes("Image");
|
||||
rslt.image = new BufferInputStream(img);
|
||||
if (img == null) {
|
||||
rslt = null;
|
||||
} else {
|
||||
rslt.image = new BufferInputStream(img);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
@ -138,7 +138,11 @@ public class PostgreSQLMapStorage extends MapStorage {
|
||||
rslt.lastModified = rs.getLong("LastUpdate");
|
||||
rslt.format = MapType.ImageEncoding.fromOrd(rs.getInt("Format"));
|
||||
byte[] img = rs.getBytes("Image");
|
||||
rslt.image = new BufferInputStream(img);
|
||||
if (img == null) {
|
||||
rslt = null;
|
||||
} else {
|
||||
rslt.image = new BufferInputStream(img);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
@ -129,7 +129,11 @@ public class SQLiteMapStorage extends MapStorage {
|
||||
// Trim trailing zeros from padding by BLOB field
|
||||
while((len > 0) && (img[len-1] == '\0')) len--;
|
||||
}
|
||||
rslt.image = new BufferInputStream(img, len);
|
||||
if (img == null) {
|
||||
rslt = null;
|
||||
} else {
|
||||
rslt.image = new BufferInputStream(img, len);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
|
Loading…
Reference in New Issue
Block a user