diff --git a/edk2toollib/database/tables/instanced_inf_table.py b/edk2toollib/database/tables/instanced_inf_table.py index 52da78a7..ffce63e3 100644 --- a/edk2toollib/database/tables/instanced_inf_table.py +++ b/edk2toollib/database/tables/instanced_inf_table.py @@ -222,17 +222,18 @@ def _parse_inf_recursively( library_class_list.append(lib) # - # 2. Append all NULL library instances + # 2. Append all NULL library instances if parsing the component. # - for null_lib in override_dict["NULL"]: - library_instance_list.append(null_lib) - library_class_list.append("NULL") - - for null_lib in self._get_null_lib_instances(scope, library_dict): - if null_lib == inf: - continue - library_instance_list.append(null_lib) - library_class_list.append("NULL") + if inf == component: + for null_lib in override_dict["NULL"]: + library_instance_list.append(null_lib) + library_class_list.append("NULL") + + for null_lib in self._get_null_lib_instances(scope, library_dict): + if null_lib == inf: + continue + library_instance_list.append(null_lib) + library_class_list.append("NULL") # # 3. Recursively parse used libraries