aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-19 22:12:47 +0100
committergingerBill <bill@gingerbill.org>2023-06-19 22:12:47 +0100
commit6568625dea679b4622024f62fc14725aa49b2106 (patch)
treee7b06b3450671094640d73e1d233dd1654db359a /src/types.cpp
parent427f212170114b006fcb6ff1366231f99acff13e (diff)
Fix line error printing for error messages
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 3cc077f84..f3b7f5bab 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -3326,6 +3326,9 @@ gb_internal bool are_struct_fields_reordered(Type *type) {
type = base_type(type);
GB_ASSERT(type->kind == Type_Struct);
type_set_offsets(type);
+ if (type->Struct.fields.count == 0) {
+ return false;
+ }
GB_ASSERT(type->Struct.offsets != nullptr);
i64 prev_offset = 0;
@@ -3344,6 +3347,9 @@ gb_internal Slice<i32> struct_fields_index_by_increasing_offset(gbAllocator allo
type = base_type(type);
GB_ASSERT(type->kind == Type_Struct);
type_set_offsets(type);
+ if (type->Struct.fields.count == 0) {
+ return {};
+ }
GB_ASSERT(type->Struct.offsets != nullptr);
auto indices = slice_make<i32>(allocator, type->Struct.fields.count);