diff --git a/src/0xc/std/struct.h b/src/0xc/std/struct.h index 53e820a..669273e 100644 --- a/src/0xc/std/struct.h +++ b/src/0xc/std/struct.h @@ -370,6 +370,11 @@ struct_field_read_integer( } \ \ iv_0xc = struct_field_read_integer((SF), (P), (L), &ivmem_0xc); \ + if (!iv_0xc) { \ + panicx("failed to read unsigned integer field: " \ + "obj = %s, field = %s", \ + (SF)->sf_struct, (SF)->sf_fld); \ + } \ switch ((SF)->sf_size) { \ case sizeof(uint8_t): \ v_0xc = iv_0xc->iv_int8.vu; \ @@ -424,6 +429,11 @@ struct_field_read_integer( } \ \ iv_0xc = struct_field_read_integer((SF), (P), (L), &ivmem_0xc); \ + if (!iv_0xc) { \ + panicx("failed to read signed integer field: " \ + "obj = %s, field = %s", \ + (SF)->sf_struct, (SF)->sf_fld); \ + } \ switch ((SF)->sf_size) { \ case sizeof(int8_t): \ v_0xc = iv_0xc->iv_int8.v; \