Skip to content

Commit ed7b539

Browse files
ZauberNerdstevengill
authored andcommitted
Fix possible null-access error in "removeFromFrameworksPbxGroup"
The method `project.removeFromFrameworksPbxGroup` directly tries to access `children` on `project.pbxGroupByName` - but this method might return `null` if no such group exists. To prevent a runtime error when trying to access a property on `null` we can add a check whether the requested group "Frameworks" does exist in the project and only then continue with the removal of the file. This closes #1
1 parent be8498d commit ed7b539

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/pbxProject.js

+3
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,9 @@ pbxProject.prototype.addToFrameworksPbxGroup = function(file) {
644644
}
645645

646646
pbxProject.prototype.removeFromFrameworksPbxGroup = function(file) {
647+
if (!this.pbxGroupByName('Frameworks')) {
648+
return null;
649+
}
647650
var pluginsGroupChildren = this.pbxGroupByName('Frameworks').children;
648651

649652
for (i in pluginsGroupChildren) {

0 commit comments

Comments
 (0)