Karlin-Z / DalamudPlugins

DalamudPlugins Repository
68 stars 13 forks source link

代码编译过程中遇到问题(已解决) #34

Closed SitaNya closed 8 months ago

SitaNya commented 8 months ago

在代码编译过程中发现问题 Plugin.cs文件中内部方法GetTargets()引用对象ObjectTable时可能错误取得null类型

        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)

尝试将对象Object改为静态问题解决,此外同文件中TargetManager对象也存在此问题

目前已正常完成编译,不过修改时我忘记fork了也懒得重新拉一遍了……就不提pr了,辛苦作者大大有空看一下,感谢!

SitaNya commented 8 months ago

您确认后直接关闭即可