From b89053254f945dafd03154c3a03014e79b2873bd Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Mon, 10 Nov 2014 13:00:04 +0100
Subject: [PATCH] Fix typo and added exception

---
 .../nl/lumc/sasc/biopet/core/BiopetExecutable.scala | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala
index 65f73c356..c8c1751b8 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetExecutable.scala
@@ -85,16 +85,19 @@ object BiopetExecutable extends Logging {
       return command.get
     }
 
-    // Read config files
-    for (t <- 0 until args.size) {
-      if (args(t) == "-config" || args(t) == "--config_ile") Config.global.loadConfigFile(new File(args(t + 1)))
-    }
-
     args match {
       case Array("version") => {
         println("version: " + getVersion)
       }
       case Array(module, name, passArgs @ _*) => {
+        // Reading config files
+        val argsSize = passArgs.size
+        for (t <- 0 until argsSize) {
+          if (passArgs(t) == "-config" || args(t) == "--config_file") {
+            if (t >= argsSize) throw new IllegalStateException("-config needs a value")
+            Config.global.loadConfigFile(new File(passArgs(t + 1)))
+          }
+        }
         getCommand(module, name).main(passArgs.toArray)
       }
       case Array(module) => {
-- 
GitLab