[fix] 修复Additional Compiler Arguments中输入 -nullable:enable 之后,Editor抛出InvalidCastException的bug。来自报告 https://github.com/focus-creative-games/hybridclr/issues/116

main
walon 2023-12-22 21:51:41 +08:00
parent 7c29ab804b
commit 71ad34d7ac
1 changed files with 4 additions and 3 deletions

View File

@ -59,9 +59,10 @@ namespace HybridCLR.Editor.Settings
protected static string GetFilePath()
{
return typeof(T).GetCustomAttributes(inherit: true)
.Cast<FilePathAttribute>()
.FirstOrDefault(v => v != null)
?.filepath;
.Where(v => v is FilePathAttribute)
.Cast<FilePathAttribute>()
.FirstOrDefault()
?.filepath;
}
}
[AttributeUsage(AttributeTargets.Class)]