Skip to content

Commit

Permalink
Found a bug when doing tvm stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nuernberger committed Nov 19, 2018
1 parent bbe1f32 commit bc4b027
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tech/jna.clj
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,11 @@ Use with care; the default if non found is:

(defn checknil
^Pointer [value]
(if (instance? Pointer value)
(checknil (Pointer/nativeValue value))
(if (= 0 (long value))
(let [value (->ptr-backing-store value)]
(if (= 0 (long (Pointer/nativeValue value)))
(throw (ex-info "Pointer value is nil"
{}))
(Pointer. value))))
value)))


(defn ensure-type
Expand All @@ -131,7 +130,8 @@ Use with care; the default if non found is:

(defn ensure-ptr
^Pointer [item]
(base/ensure-ptr item))
(base/ensure-ptr (->ptr-backing-store
item)))


(defmacro def-jna-fn
Expand Down

0 comments on commit bc4b027

Please sign in to comment.