From 1323877b7ed8dea3e0da4ba15fa13aaa04aaec5c Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Thu, 28 Apr 2022 14:29:57 -0700 Subject: Support complicated variable references Bug: 226974242 Test: go test Change-Id: Iaec16f5c498e7c75c9ee5d53d3499efadfba16bc --- androidmk/parser/make_strings.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'androidmk/parser/make_strings.go') diff --git a/androidmk/parser/make_strings.go b/androidmk/parser/make_strings.go index 416e43005..8afbe7edc 100644 --- a/androidmk/parser/make_strings.go +++ b/androidmk/parser/make_strings.go @@ -234,10 +234,10 @@ func (ms *MakeString) splitNFunc(n int, splitFunc func(s string, n int) []string if n != 0 { split := splitFunc(s, n) if n != -1 { - if len(split) > n { + if len(split) > n || len(split) == 0 { panic("oops!") } else { - n -= len(split) + n -= len(split) - 1 } } curMs.appendString(split[0]) -- cgit v1.2.3-59-g8ed1b