From 286d530592ca80013f6d3dccf7ba82aa4674123c Mon Sep 17 00:00:00 2001 From: retropikzel Date: Thu, 24 Jul 2025 19:15:59 +0300 Subject: [PATCH] Fixing for foreign-c-requests --- README.md | 4 ++-- foreign/c/pointer.scm | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 29724d4..219be24 100644 --- a/README.md +++ b/README.md @@ -643,8 +643,8 @@ UTF-8 encoding of the given string. (**c-utf8->string** _c-bytevector_) -Returns a newly allocated (unless empty) string whose character sequence is -encoded by the given c-bytevector. +Returns a newly allocated string whose character sequence is +encoded by the given c-bytevector. It is an error if _c-bytevector_ is null. ### Utilities diff --git a/foreign/c/pointer.scm b/foreign/c/pointer.scm index eb5fc30..ed82702 100644 --- a/foreign/c/pointer.scm +++ b/foreign/c/pointer.scm @@ -76,6 +76,8 @@ (define c-utf8->string (lambda (c-bytevector) + (when (c-null? c-bytevector) + (error "Can not turn null pointer into string")) (let ((size (c-strlen c-bytevector))) (utf8->string (c-bytevector->bytevector c-bytevector size)))))