Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target_dependency: Fix crash if target_proxy is nil. #915

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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
Loading