Prevent occasional errors caused by unwrapping nil

This commit is contained in:
Gregorio Litenstein
2017-02-05 18:47:31 -03:00
parent 59bfa0265f
commit 61a0843bb5
+4 -2
View File
@@ -89,7 +89,9 @@ class ReadCommand: OptionCommand {
break
}
if (nil != handler) { print(handler!) } else { throw CLIError.error(("An incompatible combination was used, or no application is registered to handle \(self.contentType!)")) }
let arg: String
if (self.contentType != nil) { arg = self.contentType! }
else { arg = "<subtype>" }
if (nil != handler) { print(handler!) } else { throw CLIError.error(("An incompatible combination was used, or no application is registered to handle \(arg)")) }
}
}