mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 13:37:35 +02:00
propagating exceptions from index->offset translation in substring
This commit is contained in:
parent
065cdf5d5f
commit
254f6dee05
1 changed files with 4 additions and 1 deletions
5
sexp.c
5
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_stringp, SEXP_STRING, str);
|
||||||
sexp_assert_type(ctx, sexp_fixnump, SEXP_FIXNUM, start);
|
sexp_assert_type(ctx, sexp_fixnump, SEXP_FIXNUM, start);
|
||||||
start = sexp_string_index_to_offset(ctx, self, n, str, 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);
|
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);
|
return sexp_substring_op(ctx, self, n, str, start, end);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue