Skip to content

Commit

Permalink
Merge pull request #10 from GTNewHorizons/dev
Browse files Browse the repository at this point in the history
Fix two NPEs
  • Loading branch information
Dream-Master authored May 9, 2023
2 parents 55bdf43 + 22bcc13 commit 18e2808
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/main/java/de/katzenpapst/amunra/block/BlockSlabMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ public float getMass(final World w, final int x, final int y, final int z, final
* @return
*/
@Override
public String getHarvestTool(final int metadata) {
return this.getSubBlock(metadata).getHarvestTool(metadata);
public String getHarvestTool(int metadata) {
final SubBlock sb = this.getSubBlock(metadata);
return sb == null ? null : sb.getHarvestTool(metadata);
}

/**
Expand All @@ -248,8 +249,9 @@ public String getHarvestTool(final int metadata) {
* @return Harvest level, or -1 if not the specified tool type.
*/
@Override
public int getHarvestLevel(final int metadata) {
return this.getSubBlock(metadata).getHarvestLevel(metadata);
public int getHarvestLevel(int metadata) {
final SubBlock sb = this.getSubBlock(metadata);
return sb == null ? -1 : sb.getHarvestLevel(metadata);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public boolean isDaytime() {

@Override
public String getDimensionName() {
return this.mothershipObj.getLocalizedName();
return this.mothershipObj == null ? "Mothership" : this.mothershipObj.getLocalizedName();
}

@Override
Expand Down

0 comments on commit 18e2808

Please sign in to comment.