Fix type==null case

This commit is contained in:
E. Behar 2018-07-06 23:21:13 -07:00 committed by GitHub
parent 2b2860637d
commit 829e24b23e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -110,6 +110,9 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
/// <param name="type">The type reference.</param> /// <param name="type">The type reference.</param>
private bool ShouldValidate(TypeReference type) private bool ShouldValidate(TypeReference type)
{ {
if (type == null)
return false;
// Extract scope name from type string representation for compatibility // Extract scope name from type string representation for compatibility
// Under Linux, type.Scope.Name sometimes reports incorrectly // Under Linux, type.Scope.Name sometimes reports incorrectly
string scopeName = type.ToString(); string scopeName = type.ToString();
@ -118,7 +121,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Finders
scopeName = scopeName.Substring(0, scopeName.IndexOf(".", System.StringComparison.CurrentCulture)); scopeName = scopeName.Substring(0, scopeName.IndexOf(".", System.StringComparison.CurrentCulture));
return type != null && this.ValidateReferencesToAssemblies.Contains(scopeName); return this.ValidateReferencesToAssemblies.Contains(scopeName);
} }
/// <summary>Get a unique string representation of a type.</summary> /// <summary>Get a unique string representation of a type.</summary>