diff --git a/src/array.c b/src/array.c index 2f129fd22709e..cc7ffdef844b3 100644 --- a/src/array.c +++ b/src/array.c @@ -351,7 +351,8 @@ jl_array_t *jl_pchar_to_array(const char *str, size_t len) jl_value_t *jl_array_to_string(jl_array_t *a) { - // TODO: check type of array? + if (!(jl_typeis(a, jl_array_uint8_type) && jl_array_ndims(a) == 1)) + jl_error("jl_array_to_string: argument not byte vector"); jl_datatype_t *string_type = u8_isvalid((char*)a->data, jl_array_len(a)) == 1 ? // ASCII jl_ascii_string_type : jl_utf8_string_type; jl_value_t *s = (jl_value_t*)jl_gc_alloc_1w();