NullReferenceException at CanMoveItemFixed
Its spamming this error for me on all my servers.

Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <56a6d943ae3a4d459a493f1470bfed44>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <56a6d943ae3a4d459a493f1470bfed44>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0​

I deleted config & data but its still showing this error.

(20:52:25) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <d538586f5e5e4242ab8c96d9eb947de8>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <d538586f5e5e4242ab8c96d9eb947de8>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

We've tried removing all traces of the plugin on the server and installing it fresh and it's still doing it. Any idea what could be causing it?

Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <71ea2c41a62e4258a906cf3f54394cef>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <71ea2c41a62e4258a906cf3f54394cef>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0



Merged post

Solution: Change in String 336 to that:
BasePlayer player = inventory.GetComponent<BasePlayer>(); if (player == null) return null; ItemContainer container = inventory.FindContainer(targetContainer); ItemContainer originalContainer = item.GetRootContainer(); if (originalContainer == null) return null;
In response to Death ():
Something is returning null in CanMoveItem which is causing the NRE. You'll need to find what variab...
Amazing as always, Death <3
Is there anything wrong with the plugin ? 

I've gotten this error message !

Thanks for making this plugin btw, my players love it. I have donated to you as a mean to say thank you !
Since the update recently and I have removed all Furnace Splitter v2.1.7 even wipped out the config and lang file and config and data reloadeed 100% and I get all the following error even on a fresh download and install. 
 18:11:36Loaded plugin Furnace Splitter v2.1.7 by Skipcast
 18:11:38Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)
 18:11:38 at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <f5e2cea502794beab07f7a6135d5cfe7>:0 
 18:11:38 at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <f5e2cea502794beab07f7a6135d5cfe7>:0 
 18:11:38 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
 18:11:38 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
 18:11:38 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

(18:51:14) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <6f9b109d27bd44cf93c1e6db093ca61d>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <6f9b109d27bd44cf93c1e6db093ca61d>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

(18:51:16) | Saved 56,300 ents, cache(0.84), write(0.06), disk(0.02).

(18:51:17) | Saving complete

(18:51:24) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <6f9b109d27bd44cf93c1e6db093ca61d>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <6f9b109d27bd44cf93c1e6db093ca61d>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

Hello, I'm new on the rust and I'm trying to create a modded server. After installing the plug-in and restarting the plug-in server, it still does not work what should I do?
please help whats going on

(13:54:25) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <00f242337bd24a55b1905c912b7984a4>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <00f242337bd24a55b1905c912b7984a4>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

Did you grant the permission to a group?
It's not working for me either.
Did you check your oxide/logs for errors?
00:08 [Error] Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <9dcfc59f20e84cd7bd1aa9dcc923e786>:0 
  at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <9dcfc59f20e84cd7bd1aa9dcc923e786>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0 

Seems that I am getting these errors

5c56cc6da8c19.png Death
Something is returning null in CanMoveItem which is causing the NRE. You'll need to find what variable, object or string is returning a null value. When a value is null it's empty. If you attempt to cast, convert or declare something that is null it will return an NRE if not properly null checked.

In this case, your function is CanMoveItem with the following arguments: Item item, PlayerInventory inventory, uint targetContainer, int targetSlot. One of these 'arguments' are either returning a null value or being cast from a null object.

 private object CanMoveItem(Item item, PlayerInventory inventory, uint targetContainer, int targetSlot)
        {
        }

First off, we need to ensure each argument is checked to make sure it is null. If so, we want to use a return behavior to stop the sequence. If we don't, it'll attempt to return a value where there is none.

 private object CanMoveItem(Item item, PlayerInventory inventory, uint targetContainer, int targetSlot)
        {
         if (item == null) return null;
         if (inventory == null) return null;
         if (targetContainer == null) return null;
        }​


If either one of our arguments is null, the sequence will be returned. If your error continues then one of your arguments is being cast as a non-null value to something that becomes null from another argument or object. In this case, we'd want to see which object is causing our NRE. To do this you'd want to print each value to console to see if either of them returns null. In this case, we want to print item, inventory, targetSlot, container, originalContainer to ensure they're not null.

Add the following to the code and ensure you do so AFTER everything is declared:

Puts($"Debug: {item} || {inventory} || {targetSlot} || {container} || {originalContainer}");

So it looks like this:

 private object CanMoveItem(Item item, PlayerInventory inventory, uint targetContainer, int targetSlot)
        {
         if (item == null) return null;
         if (inventory == null) return null;
         if (targetContainer == null) return null;
         //other code
         Puts($"Debug: {item} || {inventory} || {targetSlot} || {container} || {originalContainer}");
        }​

Keep an eye out for the debug that appears right before an NRE, that'll be your culprit.

In this case, originalContainer is returning null which is being cast from item.GetRootContainer. Let's null check originalContainer so if it does return null the sequence will be halted, preventing the NRE.

if (originalContainer == null) return null;

So at line 336, right under ItemContainer originalContainer = item.GetRootContainer(); (Because we want it to be declared first before we check if it's null) add the following line so your code resembles:

            BasePlayer player = inventory.GetComponent<BasePlayer>();
            if (player == null)
                return null;
            ItemContainer container = inventory.FindContainer(targetContainer);
            ItemContainer originalContainer = item.GetRootContainer();
            if (originalContainer == null) return null;

It's as simple as that! I would also invest time into why item is returning null sometimes but for now, the null check for originalContainer will suffice.

PS: I may refer to things inappropriately but you get the idea :P

This completely fixed thanks death

(17:10:41) | [ChestStacks] Missing stacksize for fusebox! (Not an error, but please post in the plugin thread on oxidemod.org and let me know)

 

(17:11:00) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <18d558b9b76d4a928eee8f671ad75adc>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <18d558b9b76d4a928eee8f671ad75adc>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

(17:11:01) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <18d558b9b76d4a928eee8f671ad75adc>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <18d558b9b76d4a928eee8f671ad75adc>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0

at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

(17:11:47) | Failed to call hook 'CanMoveItem' on plugin 'FurnaceSplitter v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.FurnaceSplitter.CanMoveItem (Item item, PlayerInventory inventory, System.UInt32 targetContainer, System.Int32 targetSlot) [0x000ae] in <18d558b9b76d4a928eee8f671ad75adc>:0

at Oxide.Plugins.FurnaceSplitter.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00930] in <18d558b9b76d4a928eee8f671ad75adc>:0

at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0

at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0

Locked automatically