Fixed potential NRE during extension loading.

This commit is contained in:
the_fiddler 2009-05-11 10:31:50 +00:00
parent 25fac6226d
commit 9912691bd5

View file

@ -158,7 +158,7 @@ namespace OpenTK.Platform
Delegate old = f.GetValue(null) as Delegate; Delegate old = f.GetValue(null) as Delegate;
Delegate @new = LoadDelegate(f.Name, f.FieldType); Delegate @new = LoadDelegate(f.Name, f.FieldType);
if (old.Target != @new.Target) if ((old != null ? old.Target : null) != (@new != null ? @new.Target : null))
{ {
f.SetValue(null, @new); f.SetValue(null, @new);
FieldInfo rebuildExtensionList = type.GetField("rebuildExtensionList", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); FieldInfo rebuildExtensionList = type.GetField("rebuildExtensionList", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);