elytra/FruitPhone

Division by zero crash when checking out modded creative tabs

copygirl opened this issue · 8 comments

Full crash log: https://paste.ee/p/AjGyy

java.lang.ArithmeticException: / by zero
	at com.elytradev.fruitphone.FruitPhone$1.func_151244_d(FruitPhone.java:138)
	at net.minecraft.client.gui.inventory.GuiContainerCreative.func_147051_a(GuiContainerCreative.java:921)
	at net.minecraft.client.gui.inventory.GuiContainerCreative.func_146976_a(GuiContainerCreative.java:758)
	at net.minecraft.client.gui.inventory.GuiContainer.func_73863_a(GuiContainer.java:75)
	at net.minecraft.client.renderer.InventoryEffectRenderer.func_73863_a(InventoryEffectRenderer.java:51)
	at net.minecraft.client.gui.inventory.GuiContainerCreative.func_73863_a(GuiContainerCreative.java:643)
	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:368)
	[...]

Minecraft: 1.12.2
Minecraft Forge: 14.23.4.2705
Fruit Phone: 2.84

I'm confused about this, iTicks/20 should not cause a devision by zero regardless of what the value of iTicks is..? If that's the right line, wouldn't it be % FruitRecipes.craftableColors.size()? Since I ran the mod in optional mode, I suppose craftableColors is empty. The creative tab should not be added in the first place.

🤷‍♀️
I'm not maintaining it, just looked over the PR briefly and it didn't add any viruses so I merged it.

But yeah, paying more attention to that diff there's no way it'd fix this issue. Div by zero is caused by "x/0" not "0/x".

I assumed the PR was tested. Silly me.

I had tested the PR and couldn't reproduce the issue after the fix, i just assumed it was the issue

Although i hadn't tested it in optional mode, since that wasn't specified i didn't think to test that

🤷‍♀️

Sorry for the salt, lots of ambient stress for me lately.

gotta reproduce before the fix

(didn't mean to close, commit rewrites confuse github)