Jump to content

Cant craft Industrial Recycler

Fixed 1.8.94 1.9.0

xkirax20ax
xkirax20ax

Posted

Hello,

A NullReferenceException occurred when a player attempted to purchase an Industrial Recycler.

Plugin version:
IndustrialRecycler v1.8.94

Error:

Failed to call hook 'ConfirmPurchaseIndustrial' on plugin 'IndustrialRecycler v1.8.94' NullReferenceException: Object reference not set to an instance of an object

The stack trace points to the following methods:

IndustrialRecycler.RemoveItems(...) IndustrialRecycler.CheckAndRemoveBuyItems(...) IndustrialRecycler.ConfirmPurchaseIndustrial(...)

The Industrial Recycler purchase cost is currently configured with multiple item types:

Scrap: 1,000

High Quality Metal: 50

Metal Fragments: 1,000

The issue may be occurring while removing multiple required item types from the player's inventory.

In RemoveItems(), it appears that both player.inventory.Take(...) and item.Remove() are being called for the same item stack.

This may leave an invalid reference to an already removed item in the previously collected item list, which could then cause a NullReferenceException when item.info.shortname is accessed during the next iteration.

Could you please check this issue?

Thank you very much for your continued support.

image.png

Martian

Posted

Thank you for the detailed report. You were correct about the cause.

Both player.inventory.Take() and item.Remove() could affect the same stack, leaving an invalid item reference in the collected inventory list. I rewrote the purchase deduction process so it creates a removal plan first and then safely consumes each stack only once.

Purchases containing several different resource types, split stacks, or repeated cost entries are now handled correctly in version 1.9.0.

Martian

Posted

Changed Status from Pending to Fixed

Changed Fixed In to 1.9.0

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.7m
Total downloads
Customers
11.6k
Customers served
Files Sold
165.7k
Total sales
Payments
3.6m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.