GitHub user ZauberNerd opened a pull request: https://github.com/apache/cordova-node-xcode/pull/3
Fix null-access errors in "addTo/removeFrom*PbxGroup" methods The project exposes a few methods to add/remove children from PbxGroups * `addToPluginsPbxGroup` / `removeFromPluginsPbxGroup` * `addToResourcesPbxGroup` / `removeFromResourcesPbxGroup` * `addToFrameworksPbxGroup` / `removeFromFrameworksPbxGroup` * `addToProductsPbxGroup` / `removeFromProductsPbxGroup` which are used internally in: * `addPluginFile` / `removePluginFile` * `addResourceFile` / `removeResourceFile` * `addProductFile` / `removeProductFile` * `addFramework` / `removeFramework` But neither of these methods do a check whether the `PbxGroup` actually exists before trying to modify it - this can result in a possible null-access error. I ran into this problem when trying to add a framework to a project which didn't have a `Frameworks` `PbxGroup` (related: transistorsoft/react-native-background-fetch#30). This commit adds checks to these methods to test for existence of the `PbxGroup`s and creates them if they don't exist or does an early exit in the case of removal. Closes: #1 You can merge this pull request into a Git repository by running: $ git pull https://github.com/ZauberNerd/cordova-node-xcode fix-group-addition-deletion Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-node-xcode/pull/3.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3 ---- commit 0d52375de78bdaf6bf5db7d14ea0668a1b30df21 Author: ZauberNerd <zaubern...@zaubernerd.de> Date: 2017-06-01T12:21:50Z Fix null-access errors in "addTo/removeFrom*PbxGroup" methods The project exposes a few methods to add/remove children from PbxGroups * `addToPluginsPbxGroup` / `removeFromPluginsPbxGroup` * `addToResourcesPbxGroup` / `removeFromResourcesPbxGroup` * `addToFrameworksPbxGroup` / `removeFromFrameworksPbxGroup` * `addToProductsPbxGroup` / `removeFromProductsPbxGroup` which are used internally in: * `addPluginFile` / `removePluginFile` * `addResourceFile` / `removeResourceFile` * `addProductFile` / `removeProductFile` * `addFramework` / `removeFramework` But neither of these methods do a check whether the `PbxGroup` actually exists before trying to modify it - this can result in a possible null-access error. I ran into this problem when trying to add a framework to a project which didn't have a `Frameworks` `PbxGroup`. This commit adds checks to these methods to test for existence of the `PbxGroup`s and creates them if they don't exist or does an early exit in the case of removal. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org