jhawthorn / pub_grub

🍔 A ruby implementation of the PubGrub CDCL-based version solver
MIT License
151 stars 11 forks source link

Fix crash when error explanation includes empty ranges and version unions #20

Closed deivid-rodriguez closed 1 year ago

deivid-rodriguez commented 1 year ago

Previously this would result in an error like

  1) Error:
PubGrub::VersionUnionTest#test_intersect_empty:
NoMethodError: undefined method `max' for #<PubGrub::VersionRange::Empty (no versions)>

        if !my_range.max || (other_range.max && other_range.max < my_range.max)
                                        ^^^^
    /Users/deivid/Code/jhawthorn/pub_grub/lib/pub_grub/version_union.rb:122:in `intersect'
    /Users/deivid/Code/jhawthorn/pub_grub/test/pub_grub/version_union_test.rb:224:in `test_intersect_empty'
jhawthorn commented 1 year ago

Thank you!