Commit 48d9beb0e309f863f82d036ecfc9552fb55065c6

Thomas de Grivel 2024-07-29T19:00:33

err_puts for str_init_slice

diff --git a/libkc3/str.c b/libkc3/str.c
index f77638c..6809d5a 100644
--- a/libkc3/str.c
+++ b/libkc3/str.c
@@ -319,9 +319,16 @@ s_str * str_init_slice (s_str *str, const s_str *src, sw start, sw end)
   assert(str);
   assert(src);
   buf_init(&buf, false, src->size, (char *) src->ptr.pchar);
-  if (! str_sw_pos_to_uw(start, src->size, &buf.rpos) ||
-      ! str_sw_pos_to_uw(end, src->size, &buf.wpos))
+  if (! str_sw_pos_to_uw(start, src->size, &buf.rpos)) {
+    err_puts("str_init_slice: str_sw_pos_to_uw: start");
+    assert(! "str_init_slice: str_sw_pos_to_uw: start");
     return NULL;
+  }
+  if (! str_sw_pos_to_uw(end, src->size, &buf.wpos)) {
+    err_puts("str_init_slice: str_sw_pos_to_uw: end");
+    assert(! "str_init_slice: str_sw_pos_to_uw: end");
+    return NULL;
+  }
   if (buf.rpos > buf.wpos) {
     err_write_1("str_init_slice: invalid positions: ");
     err_inspect_uw(&buf.rpos);