Skip to content

Commit

Permalink
Fix NoSuchElementException on servers without skins.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rollczi committed Mar 10, 2022
1 parent d50a59c commit d04bddd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

Expand All @@ -38,9 +39,13 @@ public CompletableFuture<Optional<SkullData>> extractData(String playerName) {
Property property = gameProfile.getProperties().get("textures").iterator().next();

return Optional.of(new SkullData(property.getSignature(), property.getValue()));
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException exception) {
}
catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException exception) {
exception.printStackTrace();
}
catch (NoSuchElementException ignored) {
return Optional.empty();
}

return Optional.empty();
});
Expand Down

0 comments on commit d04bddd

Please sign in to comment.