Carrot_Edward Carrot_Edward
关注数: 11 粉丝数: 13 发帖数: 668 关注贴吧数: 4
尝试分析秘闻系统更新后的传剑坏档BUG 个人分析总结:NPE错误 个人推荐处理方法:参考秘闻 getVal 方法对 metaDataId 为空的情况进行处理,通过其他方式获取正确可用的 metaDataId。目前还没逆练 MOD 编程,有精力尝试修复拯救一下我的坏档。 希望有经验的大佬们看看我的分析过程是否正确,顺便还有两个问题希望能提供解答: 1. 报错路径 [b]in C:\GitLab-Runner\builds\n1JyyH3P\0\[/b] 是指本地路径还是生成的虚拟路径? 2. metaDataId 是什么作用?代表什么?如何查看这些变量的定义类? @au茄子 @qweytr_123 BUG触发条件:被侵袭以向打死之后传剑任意同道 BUG现象:进程关闭,游戏失去响应,只能通过控制台关闭主程序 [collapse=报错堆栈信息]Incoming message: ErrorMessages Incoming message: Disconnect ReadInterProcessMessages thread is about to exit. 2022-10-02 17:44:01.2502|ERROR|Main|GameData.Program|System.NullReferenceException: Object reference not set to an instance of an object. at GameData.Domains.Extra.ExtraDomain.GetCharacterSecretInformationUsedCount(Int32 characterId, Int32 metaDataId) in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\Domains\Extra\ExtraDomain_Data_Information.cs:line 23 at GameData.Domains.Information.InformationDomain.GetSecretInformationDisplayPackageFromCharacter(Int32 characterId) in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\Domains\Information\InformationDomain_Calc_SecretInformation.cs:line 426 at GameData.Domains.Information.InformationDomain.CallMethod(Operation operation, RawDataPool argDataPool, RawDataPool returnDataPool, DataContext context) in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\Domains\Information\InformationDomain_Interface.cs:line 376 at GameData.GameDataBridge.GameDataBridge.ProcessMethodCall(Operation operation, RawDataPool argDataPool, DataContext context) in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\GameDataBridge\GameDataBridge.cs:line 296 at GameData.GameDataBridge.GameDataBridge.ProcessOperations(DataContext context) in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\GameDataBridge\GameDataBridge.cs:line 263 at GameData.GameDataBridge.GameDataBridge.RunMainLoop() in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\GameDataBridge\GameDataBridge.cs:line 137 at GameData.Program.Main(String[] args) in C:\GitLab-Runner\builds\n1JyyH3P\0\scroll-of-taiwu\game-data\GameData\Program.cs:line 64 UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:LogError(Object) GameData.GameDataBridge.GameDataBridge:CheckErrorMessages() GameData.GameDataBridge.UnityAdapter.GameDataBridgeUnityAdapter:Update()[/collapse] 从最近调用方法分析代码。 [code] // Token: 0x06003743 RID: 14147 RVA: 0x001AB994 File Offset: 0x001A9B94 public sbyte GetCharacterSecretInformationUsedCount(int characterId, int metaDataId) { SecretInformationCharacterUsedCount usedCountData; sbyte count; bool flag = this._characterSecretInformationUsedCounts.TryGetValue(characterId, out usedCountData) && usedCountData.UsedCounts.TryGetValue(metaDataId, out count); sbyte result; if (flag) { result = Math.Max(0, count); } else { result = 0; } return result; } [/code] 追踪两个TryGetValue方法,第一个没有发现问题 [code] public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { ref TValue ptr = ref this.FindValue(key); if (!Unsafe.IsNullRef<TValue>(ref ptr)) { value = ptr; return true; } value = default(TValue); return false; } [/code] 第二个追踪对应类实现方法发现并未对 metaDataId 为空的情况进行判断,导致空指针错误 [code] bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value); [/code]
1 下一页