Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c17ac00 authored by Jooyung Han's avatar Jooyung Han
Browse files

Check `base` property before using it

OverrideModule's `base` property should point a valid
module(OverridableModule).

It should be checked before using it.

Bug: 159503211
Test: add `override_apex` without `base`
      m emits error, not panic.
Change-Id: I1d7c9395cc9a7461e317dd4b6ddbec3a9e68e9bf
(cherry picked from commit 3851b0c1fe8e8ffd3d30b4b8a5289f39a2c98270)
parent 1bb4665c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -223,6 +223,11 @@ var overrideBaseDepTag overrideBaseDependencyTag
// next phase.
func overrideModuleDepsMutator(ctx BottomUpMutatorContext) {
	if module, ok := ctx.Module().(OverrideModule); ok {
		base := String(module.getOverrideModuleProperties().Base)
		if !ctx.OtherModuleExists(base) {
			ctx.PropertyErrorf("base", "%q is not a valid module name", base)
			return
		}
		// See if there's a prebuilt module that overrides this override module with prefer flag,
		// in which case we call SkipInstall on the corresponding variant later.
		ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(dep Module) {