diff options
author | 2021-11-02 06:23:07 +0000 | |
---|---|---|
committer | 2021-11-02 06:24:31 +0000 | |
commit | 80b6b64db51a073056e97841a27806cc4783a27c (patch) | |
tree | b3dc9dac261907e486e49df486cb243efa0d9a88 | |
parent | 8528f4ec5efc9497f80683f6fb23ee690ed181d0 (diff) |
Add an error check in `bazelPackage` for malformed labels.
Bug: 204281595
Test: CI
Change-Id: Ia94a0b5c8dd3a0294475e9bc816a19ae03f7342d
-rw-r--r-- | android/bazel_paths.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/android/bazel_paths.go b/android/bazel_paths.go index 995736999..23b2e7a68 100644 --- a/android/bazel_paths.go +++ b/android/bazel_paths.go @@ -370,11 +370,17 @@ func BazelModuleLabel(ctx TopDownMutatorContext, module blueprint.Module) string func bazelShortLabel(label string) string { i := strings.Index(label, ":") + if i == -1 { + panic(fmt.Errorf("Could not find the ':' character in '%s', expected a fully qualified label.", label)) + } return label[i:] } func bazelPackage(label string) string { i := strings.Index(label, ":") + if i == -1 { + panic(fmt.Errorf("Could not find the ':' character in '%s', expected a fully qualified label.", label)) + } return label[0:i] } |