From 7d621f82dbe4c2a923c0aafb5337b3b0a98974d8 Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Fri, 1 Oct 2021 12:03:39 -0500 Subject: [PATCH] Consider nil as `null?` --- CHANGELOG.md | 1 + src/clj/coffi/mem.clj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 717ee20..1a6a7ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This change ## [Unreleased] ### Fixed +- `nil` was not considered a null pointer - Primitive-serializing types fail to compile as arguments to downcall handles - Primitive-serializing types fail to load as arguments to upcall functions - Void return types on upcalls crash the JVM diff --git a/src/clj/coffi/mem.clj b/src/clj/coffi/mem.clj index c885226..fb050c3 100644 --- a/src/clj/coffi/mem.clj +++ b/src/clj/coffi/mem.clj @@ -128,7 +128,7 @@ (defn null? "Checks if a memory address is null." [addr] - (.equals (MemoryAddress/NULL) addr)) + (or (.equals (MemoryAddress/NULL) addr) (not addr))) (defn slice-global "Gets a slice of the global address space.