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)))))