Skip to content

Commit

Permalink
Merge pull request Squirrel#227 from Squirrel/parse-shortcut-fix
Browse files Browse the repository at this point in the history
Avoid crashing when the user doesn't supply any shortcutLocations.
  • Loading branch information
anaisbetts committed Feb 11, 2015
2 parents e9a1986 + 7b540a0 commit 709a7f5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,14 +629,17 @@ static string getAppNameFromDirectory(string path = null)
static ShortcutLocation? parseShortcutLocations(string shortcutArgs)
{
var ret = default(ShortcutLocation?);
var args = shortcutArgs.Split(new[] { ',' });

foreach (var arg in args) {
var location = (ShortcutLocation)(Enum.Parse(typeof(ShortcutLocation), arg, false));
if (ret.HasValue) {
ret |= location;
} else {
ret = location;

if (!String.IsNullOrWhiteSpace(shortcutArgs)) {
var args = shortcutArgs.Split(new[] { ',' });

foreach (var arg in args) {
var location = (ShortcutLocation)(Enum.Parse(typeof(ShortcutLocation), arg, false));
if (ret.HasValue) {
ret |= location;
} else {
ret = location;
}
}
}

Expand Down

0 comments on commit 709a7f5

Please sign in to comment.