Skip to content

Commit 95594b4

Browse files
vemvbbatsov
authored andcommitted
Fix a NPE in cljs.analysis
1 parent febf816 commit 95594b4

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### Bugs fixed
6+
7+
* Fix a NullPointerException in `orchard.cljs.analysis`.
8+
59
## 0.9.0 (2022-01-10)
610

711
### Changes

src/orchard/cljs/analysis.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
(remove (fn [[ns-sym ns]]
1212
;; Remove pseudo-namespaces that the cljs analyzer
1313
;; started returning at some point:
14-
(or (-> ns-sym name (.startsWith "goog."))
14+
(or (some-> ns-sym name (.startsWith "goog."))
1515
;; recent CLJS versions include data about macro namespaces in the
1616
;; compiler env, but we should not include them in completions or pass
1717
;; them to format-ns unless they're actually required (which is handled
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns orchard.cljs.analysis-test
2+
(:require
3+
[clojure.test :refer [deftest is testing]]
4+
[orchard.cljs.analysis :as sut]))
5+
6+
;; Covers a NPE caught in the wild: https://gist.github.com/dgtized/aa046d06c921d4cb9f7dc51ea2729459
7+
(deftest all-ns-test
8+
(testing "Handles nil-valued maps gracefully"
9+
(is (sut/all-ns {:cljs.analyzer/namespaces {nil nil}}))))

0 commit comments

Comments
 (0)