#20710:Fixing empty string support in command recipe handler

Work Item: 20710
This commit is contained in:
Stanley Goldman
2014-09-11 10:25:00 -07:00
committed by Sebastien Ros
parent 600dda4a2a
commit d33069b1ff

View File

@@ -67,8 +67,9 @@ namespace Orchard.Recipes.RecipeHandlers {
};
foreach (var arg in args) {
// Switch?
if (arg[0] == '/') {
if (arg.StartsWith("/")) {
//If arg is not empty and starts with '/'
int index = arg.IndexOf(':');
var switchName = (index < 0 ? arg.Substring(1) : arg.Substring(1, index - 1));
var switchValue = (index < 0 || index >= arg.Length ? string.Empty : arg.Substring(index + 1));