Skip to content

Commit

Permalink
[fix] Resolvido NullPointerException que ocorria em Champions
Browse files Browse the repository at this point in the history
Ao solicitar champions pela segunda vez, ele disparava o Exception, pois o Language não estava setado em Champions.java
  • Loading branch information
Cristian-Sknz committed Dec 9, 2020
1 parent 47659f0 commit 50e7bc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/me/skiincraft/api/paladins/Paladins.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private Paladins() {
this.storage = new PaladinsStorageImpl(
new StorageImpl<Champions>(new Champions[0]) {
public Champions getById(long id) {
return getAsList().stream().filter(i -> i.getLanguage().getLanguagecode() == id).findAny().orElse(null);
return getAsList().stream().filter(i -> i.getLanguage().getLanguagecode() == id).findFirst().orElse(null);
}
}, new StorageImpl<Match>(new Match[0]) {
public Match getById(long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
public class Champions implements CustomList<Champion> {

private final Champion[] champions;
private Language language;
private final Language language;

public Champions(List<Champion> champs, Language language) {
champions = new Champion[champs.size()];
this.champions = new Champion[champs.size()];
this.language = language;
AtomicInteger integer = new AtomicInteger();
for (Champion item : champs) {
champions[integer.getAndIncrement()] = item;
Expand Down

0 comments on commit 50e7bc4

Please sign in to comment.