binaryage / binaryage/cljs-oops
`oget` fails if the JS object has `:constructor` set to `null`
- Dominant language
- Clojure
- Stars
- 350
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
```clojure
=> (oget #js {:constructor nil, :a 1} :a)
TypeError: Cannot read properties of null (reading 'prototype')
at Object.oops$helpers$is_prototype_QMARK_ [as is_prototype_QMARK_] (helpers.cljs:7)
at Object.oops$helpers$cljs_type_QMARK_ [as cljs_type_QMARK_] (helpers.cljs:19)
at Object.oops$core$validate_object_access_dynamically [as validate_object_access_dynamically] (core.cljs:39)
at eval (views.cljs:308)
```
The culprit seems to be this function:
```clojure
(defn is-prototype? [o]
(identical? (.-prototype (.-constructor o)) o))
```
Perhaps it should check if `(.-constructor o)` is not `null`?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.