Skip to content

Commit

Permalink
Fix #403: NRE spam from GetModule
Browse files Browse the repository at this point in the history
-when this function was refactored there was a slight change in behavior: the previous version would return null when given a null part reference
  • Loading branch information
JonnyOThan committed Mar 19, 2024
1 parent b98b724 commit 611b9b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion FreeIva/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Type, PartModule>();
Expand Down

0 comments on commit 611b9b7

Please sign in to comment.