Skip to content

Commit bf41b1d

Browse files
committed
fix: when removing targets with projects including widgets, ref may not be found
This case can be safely ignored to prevent a cli hard exit
1 parent 8f96af8 commit bf41b1d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/pbxProject.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,10 +1855,13 @@ pbxProject.prototype.removeTarget = function(target, targetKey) {
18551855

18561856
if(!stillReferenced) {
18571857
var frameworkFileRef = fileReferenceSection[fileRef];
1858-
var fileToRemove = new pbxFile(unquote(frameworkFileRef.path), {basename: frameworkFileRef.name});
1859-
fileToRemove.fileRef = fileRef;
1860-
this.removeFromFrameworksPbxGroup(fileToRemove);
1861-
removeItemAndCommentFromSectionByUuid(fileReferenceSection, fileRef);
1858+
if (frameworkFileRef?.path) {
1859+
// when working with widgets, the framework might be in a different group
1860+
var fileToRemove = new pbxFile(unquote(frameworkFileRef.path), {basename: frameworkFileRef.name});
1861+
fileToRemove.fileRef = fileRef;
1862+
this.removeFromFrameworksPbxGroup(fileToRemove);
1863+
removeItemAndCommentFromSectionByUuid(fileReferenceSection, fileRef);
1864+
}
18621865
}
18631866
}
18641867
files = files.concat(frameworkFiles);

0 commit comments

Comments
 (0)