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

Null ptr Exception when assoc'ing to a map starting with a comment #33

Closed
ikappaki opened this issue Nov 25, 2022 · 2 comments
Closed

Comments

@ikappaki
Copy link

Hi,

rewrite-edn throws a null ptr exception when associng to a map which starts with a comment:

Execution error (NullPointerException) at rewrite-clj.custom-zipper.core/node (core.cljc:55).
Cannot invoke "clojure.lang.IFn.invoke(Object)" because "loc" is null

To reproduce,

  1. On the repl, try to assoc to such a map
(borkdude.rewrite-edn/assoc (borkdude.rewrite-edn/parse-string "{;;a comment\n}") :a 1)
  1. It throws the error below

I had a look at assoc* but not sure what is the right way to fix this, so I left it to the expert :)

Thanks

error

Unhandled java.lang.NullPointerException
   Cannot invoke "clojure.lang.IFn.invoke(Object)" because "loc" is
   null

                   zip.clj:   67  clojure.zip/node
                   zip.clj:   64  clojure.zip/node
                 core.cljc:   55  rewrite_clj.custom_zipper.core$node/invokeStatic
                 core.cljc:   55  rewrite_clj.custom_zipper.core$node/invoke
                  zip.cljc:  178  rewrite_clj.zip$node/invokeStatic
                  zip.cljc:  176  rewrite_clj.zip$node/invoke
                 impl.cljc:   73  borkdude.rewrite_edn.impl$assoc_STAR_/invokeStatic
                 impl.cljc:   42  borkdude.rewrite_edn.impl$assoc_STAR_/invoke
                 impl.cljc:  116  borkdude.rewrite_edn.impl$assoc/invokeStatic
                 impl.cljc:  114  borkdude.rewrite_edn.impl$assoc/invoke
          rewrite_edn.cljc:   22  borkdude.rewrite_edn$assoc/invokeStatic
          rewrite_edn.cljc:   18  borkdude.rewrite_edn$assoc/invoke
@borkdude
Copy link
Owner

Fixed in 0.4.6

@ikappaki
Copy link
Author

Fixed in 0.4.6

Thanks I can confirm it now works.

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

2 participants