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

IntMap.mapValues crashes with a NPE #50

Open
aphyr opened this issue Nov 7, 2023 · 0 comments
Open

IntMap.mapValues crashes with a NPE #50

aphyr opened this issue Nov 7, 2023 · 0 comments

Comments

@aphyr
Copy link
Contributor

aphyr commented Nov 7, 2023

Not totally sure what's up here, but map-value seems to work OK on normal maps, but not on int-maps. It looks like it passes a null value to the function?

(deftest ^:buggy map-values-test
  (let [m (i/from {1 10, 3 30})]
    (testing "IMap"
      ; This fails due to a bug I think
      (is (= {1 11 3 31} (datafy (m/map-values m (fn [k v]
                                                   (prn :k k :v v)
                                                   v))))))))
:k 0 :v nil
...
                          bifurcan-clj.int-map-test/fn                                                           int_map_test.clj:   77
                           bifurcan-clj.map/map-values                                                                    map.clj:  202
                   io.lacuna.bifurcan.IntMap.mapValues                                                                IntMap.java:   23
                   io.lacuna.bifurcan.IntMap.mapValues                                                                IntMap.java:  286
     io.lacuna.bifurcan.nodes.IntMapNodes$Node.mapVals                                                           IntMapNodes.java:  197
java.lang.NullPointerException: Cannot invoke "io.lacuna.bifurcan.nodes.IntMapNodes$Node.mapVals(Object, java.util.function.BiFunction)" because "<local3>.content[<local4>]" is null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant