[seed] Improve handling of case where constructing struct with 0 size



commit a08ec31a2833e681b9c91a62fc1a6f60c4259187
Author: Robert Carr <racarr gnome org>
Date:   Thu Dec 17 17:32:36 2009 -0500

    Improve handling of case where constructing struct with 0 size

 libseed/seed-structs.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-structs.c b/libseed/seed-structs.c
index 42b5d52..1c58e0a 100644
--- a/libseed/seed-structs.c
+++ b/libseed/seed-structs.c
@@ -690,7 +690,12 @@ seed_construct_struct_type_with_parameters (JSContextRef ctx,
     {
       size = g_union_info_get_size ((GIUnionInfo *) info);
     }
-  g_assert (size);
+  if (!size)
+    {
+      g_critical ("Struct/union of type: %s has size 0 in introspection data. Please check GIR",
+		  g_base_info_get_name (info));
+      g_assert(size);
+    }
   object = g_slice_alloc0 (size);
 
   SEED_NOTE (CONSTRUCTION,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]