Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8091


Ignore:
Timestamp:
06/23/12 00:21:50 (12 years ago)
Author:
ascheibe
Message:

#1877 fixed NullReferenceExceptions in MetaOpt detected by TestCloningAllDeepCloneables

Location:
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/ConstrainedTypeValue.cs

    r7153 r8091  
    3838    protected ConstrainedTypeValue(ConstrainedTypeValue original, Cloner cloner)
    3939      : base(original, cloner) {
    40       this.validTypes = new List<Type>(original.validTypes);
     40      if (original.validTypes != null)
     41        this.validTypes = new List<Type>(original.validTypes);
    4142    }
    4243    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs

    r6489 r8091  
    5959      }
    6060    }
    61    
     61
    6262    [Storable]
    6363    private DoubleArray bestQualities;
     
    185185      this.runs = cloner.Clone(original.runs);
    186186      this.parameters = new Dictionary<string, IItem>();
    187       foreach (var p in original.parameters) {
    188         this.parameters.Add(p.Key, cloner.Clone(p.Value));
     187      if (original.parameters != null) {
     188        foreach (var p in original.parameters) {
     189          this.parameters.Add(p.Key, cloner.Clone(p.Value));
     190        }
    189191      }
    190192    }
     
    194196    [StorableHook(HookType.AfterDeserialization)]
    195197    private void AfterDeserialization() {
    196       if(ProblemConfiguration != null) ProblemConfiguration.ValuesReadOnly = true;
     198      if (ProblemConfiguration != null) ProblemConfiguration.ValuesReadOnly = true;
    197199    }
    198200    #endregion
     
    304306      this.CollectResultValues(run.Results);
    305307      this.CollectParameterValues(run.Parameters);
    306       if(clearParameters) MetaOptimizationUtil.ClearParameters(run, this.GetOptimizedParameterNames());
     308      if (clearParameters) MetaOptimizationUtil.ClearParameters(run, this.GetOptimizedParameterNames());
    307309      return run;
    308310    }
Note: See TracChangeset for help on using the changeset viewer.