Skip to content

Commit

Permalink
Merge pull request #915 from byohay/feature/fix-target-dependency-crash
Browse files Browse the repository at this point in the history
target_dependency: Fix crash if `target_proxy` is `nil`.
  • Loading branch information
amorde committed Jan 28, 2024
2 parents c1cd865 + 0303c0b commit f59847b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

##### Bug Fixes

* None.
* target_dependency: Fix crash if target_proxy is nil.
[Ben Yohay](https://github.com/byohay)
[#915](https://github.com/CocoaPods/Xcodeproj/pull/915)


## 1.22.0 (2022-06-22)
Expand Down
2 changes: 1 addition & 1 deletion lib/xcodeproj/project/object/target_dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def to_tree_hash
hash = {}
hash['displayName'] = display_name
hash['isa'] = isa
hash['targetProxy'] = target_proxy.to_tree_hash
hash['targetProxy'] = target_proxy.to_tree_hash if target_proxy
hash
end

Expand Down
11 changes: 11 additions & 0 deletions spec/project/object/target_dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ module ProjectSpecs
}
end

it 'tree hash for target dependency without target proxy' do
target = @project.new_target(:static, 'Pods', :ios)
@target_dependency.target = target
target.dependencies << @target_dependency

@target_dependency.to_tree_hash.should == {
'displayName' => 'Pods',
'isa' => 'PBXTargetDependency',
}
end

#----------------------------------------#

describe '#display_name' do
Expand Down

0 comments on commit f59847b

Please sign in to comment.