kkinnear / zprint

Executables, uberjar, and library to beautifully format Clojure and Clojurescript source code and s-expressions.
MIT License
559 stars 49 forks source link

NPE in sort-reqs #342

Open agriffis opened 1 day ago

agriffis commented 1 day ago

This is similar to an issue previously reported at https://github.com/kkinnear/zprint/issues/310#issuecomment-1956297538

(ns foo (:require [a.b.c :refer []]))

This fails for me with

When :list called an option-fn named 'sort-reqs' it failed because: java.lang.NullPointerException

I don't know what :refer [] means here. Blame my coworker. But the formatter probably shouldn't fail. :joy:

zprint 1.2.9

kkinnear commented 1 day ago

Thank you very much! The formatter certainly shouldn't fail, and I can reproduce it. I will fix it in the next release. It isn't a trivial fix because the code that rewrites things (as in sorting them) is rather complex.