[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,8 +59,9 @@ namespace HybridCLR.Editor.Settings
protected static string GetFilePath() protected static string GetFilePath()
{ {
return typeof(T).GetCustomAttributes(inherit: true) return typeof(T).GetCustomAttributes(inherit: true)
.Where(v => v is FilePathAttribute)
.Cast<FilePathAttribute>() .Cast<FilePathAttribute>()
.FirstOrDefault(v => v != null) .FirstOrDefault()
?.filepath; ?.filepath;
} }
} }