tonsky / datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
Eclipse Public License 1.0
5.45k stars 304 forks source link

fix: error when find-datom on empty-db #477

Closed RCmerci closed 1 month ago

RCmerci commented 1 month ago

d/find-datom will throw an error when calling on an empty-db. Is this behavior by design or a mistake?

> (d/find-datom (d/empty-db {:age {:db/index true}}) :eavt)
Execution error (NullPointerException) at me.tonsky.persistent-sorted-set/seek (persistent_sorted_set.clj:51).
Cannot invoke "me.tonsky.persistent_sorted_set.Seq.seek(Object)" because "seq" is null

I expect it to return nil when an empty-db is used as arg to find-datom.

tonsky commented 1 month ago

Thanks! Pushed 1.7.3