Index: /trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjectorView.cs
===================================================================
--- /trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjectorView.cs	(revision 494)
+++ /trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjectorView.cs	(revision 495)
@@ -39,5 +39,6 @@
     }
 
-    public StructIdProblemInjectorView() : base() {
+    public StructIdProblemInjectorView()
+      : base() {
       InitializeComponent();
     }
@@ -62,5 +63,5 @@
     protected override void UpdateControls() {
       base.UpdateControls();
-      if (StructIdProblemInjector == null) {
+      if(StructIdProblemInjector == null) {
         importInstanceButton.Enabled = false;
       } else {
@@ -72,5 +73,5 @@
 
     private void importInstanceButton_Click(object sender, EventArgs e) {
-      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
+      if(openFileDialog.ShowDialog(this) == DialogResult.OK) {
         DatasetParser parser = new DatasetParser();
         bool success = false;
@@ -90,5 +91,5 @@
           ShowErrorMessageBox(ex);
         }
-        if (success) {
+        if(success) {
           Dataset dataset = (Dataset)StructIdProblemInjector.GetVariable("Dataset").Value;
           dataset.Rows = parser.Rows;
@@ -98,19 +99,31 @@
           dataset.Samples = new double[dataset.Rows * dataset.Columns];
           Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows);
-          ((IntData)StructIdProblemInjector.GetVariable("TrainingSamplesStart").Value).Data = parser.TrainingSamplesStart;
-          ((IntData)StructIdProblemInjector.GetVariable("TrainingSamplesEnd").Value).Data = parser.TrainingSamplesEnd;
-          ((IntData)StructIdProblemInjector.GetVariable("ValidationSamplesStart").Value).Data = parser.ValidationSamplesStart;
-          ((IntData)StructIdProblemInjector.GetVariable("ValidationSamplesEnd").Value).Data = parser.ValidationSamplesEnd;
-          ((IntData)StructIdProblemInjector.GetVariable("TestSamplesStart").Value).Data = parser.TestSamplesStart;
-          ((IntData)StructIdProblemInjector.GetVariable("TestSamplesEnd").Value).Data = parser.TestSamplesEnd;
-          ((IntData)StructIdProblemInjector.GetVariable("TargetVariable").Value).Data = parser.TargetVariable;
-          ItemList<IntData> allowedFeatures = (ItemList<IntData>)StructIdProblemInjector.GetVariable("AllowedFeatures").Value;
-          allowedFeatures.Clear();
-          List<int> nonInputVariables = parser.NonInputVariables;
-          for(int i = 0; i < dataset.Columns; i++) {
-            if(!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i));
+          TrySetVariable("TrainingSamplesStart", parser.TrainingSamplesStart);
+          TrySetVariable("TrainingSamplesStart", parser.TrainingSamplesStart);
+          TrySetVariable("TrainingSamplesEnd", parser.TrainingSamplesEnd);
+          TrySetVariable("ValidationSamplesStart", parser.ValidationSamplesStart);
+          TrySetVariable("ValidationSamplesEnd", parser.ValidationSamplesEnd);
+          TrySetVariable("TestSamplesStart", parser.TestSamplesStart);
+          TrySetVariable("TestSamplesEnd", parser.TestSamplesEnd);
+          TrySetVariable("TargetVariable", parser.TargetVariable);
+
+          IVariable var = StructIdProblemInjector.GetVariable("AllowedFeatures");
+          if(var != null) {
+            ItemList<IntData> allowedFeatures = (ItemList<IntData>)var.Value;
+            allowedFeatures.Clear();
+            List<int> nonInputVariables = parser.NonInputVariables;
+            for(int i = 0; i < dataset.Columns; i++) {
+              if(!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i));
+            }
           }
           Refresh();
         }
+      }
+    }
+
+    private void TrySetVariable(string name, int value) {
+      IVariable var = StructIdProblemInjector.GetVariable(name);
+      if(var != null) {
+        ((IntData)var.Value).Data = value;
       }
     }
