Skip to content

Fixed giving null assembly name when assembly is present. #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Editor/Extensions/MonoScriptExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ private static string GetProperClassName(string rawClassName)
/// </returns>
[PublicAPI, NotNull] public static string GetAssemblyName(this MonoScript script)
{
string assemblyName = script.Internal_GetAssemblyName();
string assemblyName = script.Internal_GetAssemblyName();
int lastDotIndex = assemblyName.LastIndexOf('.');
return lastDotIndex == -1 ? string.Empty : assemblyName.Substring(0, lastDotIndex);
if(assemblyName == null || assemblyName == string.Empty)
{
return string.Empty;
}
return lastDotIndex == -1 ? assemblyName : assemblyName.Substring(0, lastDotIndex);
}

private static string GetNamespaceName(this MonoScript asset)
Expand All @@ -101,4 +105,4 @@ private static string GetNamespaceName(this MonoScript asset)
return match.Success ? match.Value : string.Empty;
}
}
}
}