Fallback to default icon for any errors whilst getting a server's favicon
All checks were successful
Deploy API / docker (17, 3.8.5) (push) Successful in 1m41s

This commit is contained in:
Braydon 2024-04-23 01:09:39 -04:00
parent 8456829c30
commit 4b55674a98

@ -356,10 +356,13 @@ public final class MojangService {
} catch (BadRequestException | ResourceNotFoundException ignored) {
// Safely ignore these, we will use the default server icon
}
if (icon == null) { // Use the default server icon
icon = DEFAULT_SERVER_ICON;
try {
assert icon != null;
return Base64.getDecoder().decode(icon); // Return the decoded favicon
} catch (Exception ex) { // Use the default server icon
log.error("Failed getting server favicon for %s:".formatted(hostname), ex);
return Base64.getDecoder().decode(DEFAULT_SERVER_ICON);
}
return Base64.getDecoder().decode(icon); // Return the decoded favicon
}
/**