From 6ac63ef003642cf12ee728ae897179bdf5ed7030 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 17 Oct 2017 20:35:34 -0700 Subject: [PATCH] Fix soong_ui with empty arguments Test: build/soong/soong_ui.bash --make-mode "" nothing Change-Id: I8bbe947078eaa00976811ce1b9b34e1a7c23f97f --- ui/build/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/build/config.go b/ui/build/config.go index c8d729213..191a1029b 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -154,7 +154,7 @@ func (c *configImpl) parseArgs(ctx Context, args []string) { c.verbose = true } else if arg == "--skip-make" { c.skipMake = true - } else if arg[0] == '-' { + } else if len(arg) > 0 && arg[0] == '-' { parseArgNum := func(def int) int { if len(arg) > 2 { p, err := strconv.ParseUint(arg[2:], 10, 31) @@ -172,9 +172,9 @@ func (c *configImpl) parseArgs(ctx Context, args []string) { return def } - if arg[1] == 'j' { + if len(arg) > 1 && arg[1] == 'j' { c.parallel = parseArgNum(c.parallel) - } else if arg[1] == 'k' { + } else if len(arg) > 1 && arg[1] == 'k' { c.keepGoing = parseArgNum(0) } else { ctx.Fatalln("Unknown option:", arg)