From 254f6dee0569def33bcca6c7458bceaeb2568c49 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 16 Jul 2012 14:11:06 +0900 Subject: [PATCH] propagating exceptions from index->offset translation in substring --- sexp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sexp.c b/sexp.c index edba159a..99045a80 100644 --- a/sexp.c +++ b/sexp.c @@ -1041,8 +1041,11 @@ sexp sexp_utf8_substring_op (sexp ctx, sexp self, sexp_sint_t n, sexp str, sexp sexp_assert_type(ctx, sexp_stringp, SEXP_STRING, str); sexp_assert_type(ctx, sexp_fixnump, SEXP_FIXNUM, start); start = sexp_string_index_to_offset(ctx, self, n, str, start); - if (sexp_fixnump(end)) + if (sexp_exceptionp(start)) return start; + if (sexp_fixnump(end)) { end = sexp_string_index_to_offset(ctx, self, n, str, end); + if (sexp_exceptionp(end)) return end; + } return sexp_substring_op(ctx, self, n, str, start, end); } #endif