Failed to call hook 'CanDeployItem' on plugin 'VehicleDeployedLocks v1.13.1'Fixed

Failed to call hook 'CanDeployItem' on plugin 'VehicleDeployedLocks v1.13.1' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.VehicleDeployedLocks+VehicleInfoManager.GetVehicleInfo (BaseEntity entity) [0x00000] in <353035cd9dfa490480b76a34b4ef6a8c>:0 3kb/s in, 21kb/s out at Oxide.Plugins.VehicleDeployedLocks.GetVehicleAndInfo (BaseEntity entity, BasePlayer basePlayer, BaseEntity& vehicle, System.Boolean fromDeployHook) [0x00086] in <353035cd9dfa490480b76a34b4ef6a8c>:0 at Oxide.Plugins.VehicleDeployedLocks.CanDeployItem (BasePlayer basePlayer, Deployer deployer, NetworkableId entityId) [0x00078] in <353035cd9dfa490480b76a34b4ef6a8c>:0 at Oxide.Plugins.VehicleDeployedLocks.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00bc5] in <353035cd9dfa490480b76a34b4ef6a8c>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <795304323ac74a298b8ed190a1dfa739>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in :0

 

some entities aren't null checked before being passed to _vehicleInfoManager.GetVehicleInfo

            var module = entity as BaseVehicleModule;
            if (module != null)
            {
                vehicle = module.Vehicle ?? module.GetParentEntity();
                return _vehicleInfoManager.GetVehicleInfo(vehicle);
            }

            var carLift = entity as ModularCarGarage;
            if ((object)carLift != null)
            {
                 vehicle = carLift.carOccupant;
                 return _vehicleInfoManager.GetVehicleInfo(vehicle);
            }

            var hitchTrough = entity as HitchTrough;
            if ((object)hitchTrough != null)
            {
                vehicle = GetClosestHorse(hitchTrough, basePlayer);
                return _vehicleInfoManager.GetVehicleInfo(vehicle);
            }​

fix GetVehicleInfo by adding a null check first

            public VehicleInfo GetVehicleInfo(BaseEntity entity)
            {
                if (entity == null) 
                    return null;
Locked automatically