From dae5dddfd273341e7b665a133d021fbadf3db931 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 13 Jan 2020 13:25:14 +0100 Subject: [PATCH] mobile: trim arg spaces before comparison Since spaces where trimmed only after checking for empty strings, an empty flag '-- ' would be passed along to lnd. Intead we trim first to properly ingore such flags. --- mobile/bindings.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile/bindings.go b/mobile/bindings.go index 0945a17b..d18bf3b0 100644 --- a/mobile/bindings.go +++ b/mobile/bindings.go @@ -25,12 +25,15 @@ func Start(extraArgs string, unlockerReady, rpcReady Callback) { // arguments. var splitArgs []string for _, a := range strings.Split(extraArgs, "--") { + // Trim any whitespace space, and ignore empty params. + a := strings.TrimSpace(a) if a == "" { continue } - // Finally we prefix any non-empty string with --, and trim - // whitespace to mimic the regular command line arguments. - splitArgs = append(splitArgs, strings.TrimSpace("--"+a)) + + // Finally we prefix any non-empty string with -- to mimic the + // regular command line arguments. + splitArgs = append(splitArgs, "--"+a) } // Add the extra arguments to os.Args, as that will be parsed during