Skip to content

Commit

Permalink
Do not crash in get-year if passed a fishy "date" value
Browse files Browse the repository at this point in the history
i.e. guard against non-string input values
  • Loading branch information
egli committed Jan 19, 2024
1 parent 39abdce commit 0b7e40a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/clj/catalog/vubis.clj
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"Grab the date year out of a string. Return nil if `s` cannot be
parsed."
[s]
(when-let [year (and s (re-find #"\d{4}" s))]
(when-let [year (and (string? s) (re-find #"\d{4}" s))]
;; we return a legacy date here so that time literals work and
;; stay compatible with what e already have in the database
(time/java-date
Expand Down

0 comments on commit 0b7e40a

Please sign in to comment.