Fix crash when assemblies have empty location string

Fixes bug #604810.
This commit is contained in:
Richard Spiers 2009-12-18 12:21:03 +02:00 committed by Sebastian Dröge
parent 8046a36bb4
commit 9203ed7c9a

View file

@ -74,13 +74,18 @@ namespace Gst {
foreach (Assembly asm in assemblies) { foreach (Assembly asm in assemblies) {
foreach (AssemblyName ref_name in asm.GetReferencedAssemblies ()) { foreach (AssemblyName ref_name in asm.GetReferencedAssemblies ()) {
string asm_dir = Path.GetDirectoryName (asm.Location);
try { try {
Assembly ref_asm; Assembly ref_asm;
if (File.Exists (Path.Combine (asm_dir, ref_name.Name + ".dll"))) if (asm.Location != String.Empty)
ref_asm = Assembly.LoadFrom (Path.Combine (asm_dir, ref_name.Name + ".dll")); {
string asm_file = Path.Combine(Path.GetDirectoryName(asm.Location), ref_name.Name + ".dll");
if (File.Exists(asm_file))
ref_asm = Assembly.LoadFrom(asm_file);
else
ref_asm = Assembly.Load(ref_name);
}
else else
ref_asm = Assembly.Load (ref_name); ref_asm = Assembly.Load(ref_name);
Type[] ts = asm.GetTypes (); Type[] ts = asm.GetTypes ();
foreach (Type t in ts) { foreach (Type t in ts) {