lazbuild: fixed load package conflitc check, issue #41113

This commit is contained in:
mattias 2024-09-16 08:35:13 +02:00
parent 2f2884244b
commit 0e11791719

View File

@ -536,12 +536,11 @@ begin
// check if Package with same name is already loaded
ConflictPkg:=PackageGraph.FindPackageWithName(Result.Name,nil);
if not PackageGraph.PackageCanBeReplaced(ConflictPkg,Result) then
PrintErrorAndHalt(ErrorLoadPackageFailed,
'Cannot replace loaded package '+ConflictPkg.IDAsString+' with '+Result.IDAsString+' from "'+Result.Filename+'"');
if ConflictPkg<>nil then begin
// replace package
if not PackageGraph.PackageCanBeReplaced(ConflictPkg,Result) then
PrintErrorAndHalt(ErrorLoadPackageFailed,
'Cannot replace loaded package '+ConflictPkg.IDAsString+' with '+Result.IDAsString+' from "'+Result.Filename+'"');
PackageGraph.ReplacePackage(ConflictPkg,Result);
end else begin
// add to graph