Fix null pointer dereference printing an expression.
Parser.parseVariable method should always set the value of the variable it creates. Failure to do so may end up in the following: ``` $ androidmk <(printf "FOO:=(X)\nFOO:=bar\n") parse error: <input>:3:1: variable already set, previous assignment: FOO@<input>:1:5 = %!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference) (%!s(PANIC=String method: runtime error: invalid memory address or nil pointer dereference)) false ``` The cause is that calling Parser.Parse to parse `FOO=abc` created a Variable instance with nil value, causing panic on print attempt. Test: m androidmk && androidmk <(printf "FOO:=(X)\nFOO:=bar\n") (should print: ERROR: parse error: <input>:3:1: variable already set, previous assignment: FOO@<input>:1:5 = X = Not Evaluated (X = Not Evaluated) false) Change-Id: I296d7984df6d8796e0075f9eb692b234f8c94f08
Loading
Please register or sign in to comment