diff --git a/Confuser.Core/ProtectionParameters.cs b/Confuser.Core/ProtectionParameters.cs index f7b8d1d68..632a0cb49 100644 --- a/Confuser.Core/ProtectionParameters.cs +++ b/Confuser.Core/ProtectionParameters.cs @@ -10,13 +10,14 @@ namespace Confuser.Core { /// public class ProtectionParameters { private static readonly object ParametersKey = new object(); - private readonly ConfuserComponent comp; /// - /// A empty instance of . + /// A empty instance of . /// public static readonly ProtectionParameters Empty = new ProtectionParameters(null, new IDnlibDef[0]); + private readonly ConfuserComponent comp; + /// /// Initializes a new instance of the class. /// @@ -47,11 +48,13 @@ internal ProtectionParameters(ConfuserComponent component, IList targ public T GetParameter(ConfuserContext context, IDnlibDef target, string name, T defValue = default(T)) { Dictionary parameters; + if (comp == null) + return defValue; + // For packers if (comp is Packer) { parameters = new Dictionary(context.Project.Packer, StringComparer.OrdinalIgnoreCase); - } - else { + } else { // For protections var objParams = context.Annotations.Get(target, ParametersKey); if (objParams == null)