Guard against Assembly.GetEntryAssembly() being null

This commit is contained in:
Douglas R. Miles
2012-05-30 19:16:32 -07:00
parent a372d7c6a2
commit 90eaabec6f

View File

@@ -458,8 +458,15 @@ namespace OpenMetaverse
public static System.IO.Stream GetResourceStream(string resourceName, string searchPath)
{
if (searchPath != null)
{
string filename = System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), searchPath), resourceName);
{
Assembly gea = Assembly.GetEntryAssembly();
string dirname = ".";
if (gea != null)
{
dirname = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(gea.Location), searchPath);
}
string filename = System.IO.Path.Combine(dirname, resourceName);
try
{
return new System.IO.FileStream(