var PotentialTargets =
ObjectTable.Where(
o => (ObjectKind.BattleNpc.Equals(o.ObjectKind) || ObjectKind.Player.Equals(o.ObjectKind)) &&
o != Client.LocalPlayer && Utils.CanAttack(o));
报错内容为
2024-03-24 04:08:20.616 +08:00 [ERR] Exception during raise of Void <InvokeSafely>b__0()
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at BetterTargetingSystem.Plugin.GetTargets() in /work/repo/BetterTargetingSystem/Plugin.cs:line 389
at BetterTargetingSystem.Plugin.CycleTargets() in /work/repo/BetterTargetingSystem/Plugin.cs:line 259
at BetterTargetingSystem.Plugin.Update(IFramework framework) in /work/repo/BetterTargetingSystem/Plugin.cs:line 154
at Dalamud.Utility.EventHandlerExtensions.HandleInvoke(Action act)
在代码编译过程中发现问题
Plugin.cs
文件中内部方法GetTargets()
引用对象ObjectTable
时可能错误取得null类型报错内容为
尝试将对象
Object
改为静态问题解决,此外同文件中TargetManager
对象也存在此问题目前已正常完成编译,不过修改时我忘记fork了也懒得重新拉一遍了……就不提pr了,辛苦作者大大有空看一下,感谢!