Skip to content

Commit

Permalink
Fix crash when null sound processed by SoundHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
asanetargoss committed Oct 13, 2019
1 parent fa6ccdd commit 826c54e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/mchorse/metamorph/entity/SoundHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,18 @@ public void onPlaySound(PlaySoundAtEntityEvent event)
{
return;
}

SoundEvent sound = event.getSound();
if (sound == null) {
// Sounds can be null, apparently
return;
}
ResourceLocation soundResource = sound.getRegistryName();
if (soundResource == null) {
return;
}
String soundType = soundResource.getResourcePath();

String soundType = event.getSound().getRegistryName().getResourcePath();
if (soundType.endsWith(".hurt"))
{
SoundEvent newSound = morph.getHurtSound(player, morphing.getLastDamageSource());
Expand Down

0 comments on commit 826c54e

Please sign in to comment.