From 73e8e49897c2a92d5908e89f392bd40386219aab Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Wed, 27 Jul 2011 21:46:14 +0200 Subject: [PATCH] More thorough check for interior-ness in str_from_ivec Closes #750 --- src/rt/rust_builtin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 6ba749b0d5c4..eefc6dac8ceb 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -312,8 +312,9 @@ str_byte_len(rust_task *task, rust_str *s) extern "C" CDECL rust_str * str_from_ivec(rust_task *task, rust_ivec *v) { - uintptr_t fill = v->fill ? v->fill : v->payload.ptr->fill; - void *data = v->fill ? v->payload.data : v->payload.ptr->data; + bool is_interior = v->fill || !v->payload.ptr; + uintptr_t fill = is_interior ? v->fill : v->payload.ptr->fill; + void *data = is_interior ? v->payload.data : v->payload.ptr->data; rust_str *st = vec_alloc_with_data(task,