<commit_before>package com.probossgamers.turtlemod.items;

import com.probossgamers.turtlemod.TurtleMain;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class ItemModFood extends ItemFood
{

	private PotionEffect[] effects;
	
	 public ItemModFood(String unlocalizedName, int amount, float saturation, boolean isWolfFood, PotionEffect... effects) {
	        super(amount, saturation, isWolfFood);
	        this.setUnlocalizedName(unlocalizedName);
	        this.setCreativeTab(TurtleMain.tabCustom);
	        this.effects = effects;
	    }
	 
	 @Override
	 protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player)
	 {
	     super.onFoodEaten(stack, world, player);
	     
	     for (int i = 0; i < effects.length; i ++) {
	         effects[i].getPotion();
			if (!world.isRemote && effects[i] != null && Potion.getIdFromPotion(effects[i].getPotion()) > 0)
	             player.addPotionEffect(new PotionEffect(this.effects[i]));
	     }
	 }
	 
	 
}<commit_msg>Check for null potion effects.<commit_after>package com.probossgamers.turtlemod.items;

import com.probossgamers.turtlemod.TurtleMain;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class ItemModFood extends ItemFood
{

	private PotionEffect[] effects;
	
	 public ItemModFood(String unlocalizedName, int amount, float saturation, boolean isWolfFood, PotionEffect... effects) {
	        super(amount, saturation, isWolfFood);
	        this.setUnlocalizedName(unlocalizedName);
	        this.setCreativeTab(TurtleMain.tabCustom);
	        this.effects = effects;
	    }
	 
	 @Override
	 protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player)
	 {
	     super.onFoodEaten(stack, world, player);
	     if(!(effects == null))
         {
			 for (int i = 0; i < effects.length; i++)
			 {
				 effects[i].getPotion();
				 if (!world.isRemote && effects[i] != null && Potion.getIdFromPotion(effects[i].getPotion()) > 0)
				 {
					 player.addPotionEffect(new PotionEffect(this.effects[i]));
				 }
			 }
		 }
	 }
	 
	 
}
{'fraction_non_alphanumeric': 0.11207970112079702, 'fraction_numerical': 0.0016604400166044002, 'mean_word_length': 3.7254901960784315, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4043956', 'n_tokens_mistral': 846, 'n_tokens_neox': 733, 'n_words': 146}