Fixing for foreign-c-requests

This commit is contained in:
retropikzel 2025-07-24 19:15:59 +03:00
parent 4edb59ca52
commit 286d530592
2 changed files with 4 additions and 2 deletions

View File

@ -643,8 +643,8 @@ UTF-8 encoding of the given string.
(**c-utf8->string** _c-bytevector_) (**c-utf8->string** _c-bytevector_)
Returns a newly allocated (unless empty) string whose character sequence is Returns a newly allocated string whose character sequence is
encoded by the given c-bytevector. encoded by the given c-bytevector. It is an error if _c-bytevector_ is null.
### Utilities ### Utilities

View File

@ -76,6 +76,8 @@
(define c-utf8->string (define c-utf8->string
(lambda (c-bytevector) (lambda (c-bytevector)
(when (c-null? c-bytevector)
(error "Can not turn null pointer into string"))
(let ((size (c-strlen c-bytevector))) (let ((size (c-strlen c-bytevector)))
(utf8->string (c-bytevector->bytevector c-bytevector size))))) (utf8->string (c-bytevector->bytevector c-bytevector size)))))