Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Oct 2, 2023
1 parent 5fd6ce2 commit 5c17113
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions neil
Original file line number Diff line number Diff line change
Expand Up @@ -1447,13 +1447,13 @@ details on the search syntax.")))
v-older? (req-resolve 'version-clj.core/older?)]
(or
;; prefer a more recent stable
(let [candidate (or (first (filter stable-version? clojars-candidates))
(first (filter stable-version? maven-candidates)))]
(when-let [candidate (or (first (filter stable-version? clojars-candidates))
(first (filter stable-version? maven-candidates)))]
(when (v-older? (:mvn/version current) candidate)
{:mvn/version candidate}))

;; otherwise, provide a more recent unstable
(let [candidate (or (first clojars-candidates) (first maven-candidates))]
(when-let [candidate (or (first clojars-candidates) (first maven-candidates))]
(when (v-older? (:mvn/version current) candidate)
candidate))

Expand Down
6 changes: 3 additions & 3 deletions src/babashka/neil.clj
Original file line number Diff line number Diff line change
Expand Up @@ -589,13 +589,13 @@ details on the search syntax.")))
v-older? (req-resolve 'version-clj.core/older?)]
(or
;; prefer a more recent stable
(let [candidate (or (first (filter stable-version? clojars-candidates))
(first (filter stable-version? maven-candidates)))]
(when-let [candidate (or (first (filter stable-version? clojars-candidates))
(first (filter stable-version? maven-candidates)))]
(when (v-older? (:mvn/version current) candidate)
{:mvn/version candidate}))

;; otherwise, provide a more recent unstable
(let [candidate (or (first clojars-candidates) (first maven-candidates))]
(when-let [candidate (or (first clojars-candidates) (first maven-candidates))]
(when (v-older? (:mvn/version current) candidate)
candidate))

Expand Down
5 changes: 5 additions & 0 deletions test/babashka/neil/dep_upgrade_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,8 @@
(is (clojure2d-exclusions) "Exclusions are present before upgrading")
(test-util/neil "dep upgrade" :deps-file test-file-path)
(is (clojure2d-exclusions) "Exclusions are present after upgrading"))))

(deftest npe-test
(is (neil/dep->upgrade {:lib 'com.wsscode/pathom3
:current {:mvn/version "2023.01.31-alpha"}
:unstable true})))

0 comments on commit 5c17113

Please sign in to comment.