diff --git a/FreeIva/ExtensionMethods.cs b/FreeIva/ExtensionMethods.cs index e7018ef0..c0bb7c95 100644 --- a/FreeIva/ExtensionMethods.cs +++ b/FreeIva/ExtensionMethods.cs @@ -8,7 +8,7 @@ public static class ExtensionMethods // this is similar to Part.FindModuleImplementing, except that it can take an arbitrary type and will populate the cache on failure public static PartModule GetModule(this Part part, Type moduleType) { - if (moduleType == null) return null; + if (part == null || moduleType == null) return null; if (part.cachedModules == null) { part.cachedModules = new Dictionary();