Update Utils.java

Avoid null-pointer issue if given item-list contains null elements.
The issue is still that list contains these elements.
This commit is contained in:
BONNe 2019-08-11 18:12:56 +03:00 committed by GitHub
parent a50d00b2e7
commit dea71358ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ public class Utils
// items are in players inventory.
for (ItemStack item : requiredItems)
{
boolean isUnique = true;
boolean isUnique = item != null;
int i = 0;
final int requiredSize = returnItems.size();
@ -49,7 +49,7 @@ public class Utils
i++;
}
if (isUnique)
if (isUnique && item != null)
{
// The same issue as in other places. Clone prevents from changing original item.
returnItems.add(item.clone());