summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/dexbnf/type.c15
-rw-r--r--src/analysis/types/encaps.c5
2 files changed, 16 insertions, 4 deletions
diff --git a/plugins/dexbnf/type.c b/plugins/dexbnf/type.c
index 75d0b35..29ba0a8 100644
--- a/plugins/dexbnf/type.c
+++ b/plugins/dexbnf/type.c
@@ -203,14 +203,21 @@ static GDataType *dtd_field_type_descriptor(input_buffer *buffer, char ahead)
descriptor = dtd_non_array_field_type_descriptor(buffer, ahead);
- if (dim == 0)
- result = descriptor;
+ if (descriptor == NULL)
+ result = NULL;
else
{
- result = g_encapsulated_type_new(ECT_ARRAY, descriptor);
+ if (dim == 0)
+ result = descriptor;
+
+ else
+ {
+ result = g_encapsulated_type_new(ECT_ARRAY, descriptor);
- g_encapsulated_type_set_dimension(G_ENCAPSULATED_TYPE(result), dim);
+ g_encapsulated_type_set_dimension(G_ENCAPSULATED_TYPE(result), dim);
+
+ }
}
diff --git a/src/analysis/types/encaps.c b/src/analysis/types/encaps.c
index 537d849..36dc71a 100644
--- a/src/analysis/types/encaps.c
+++ b/src/analysis/types/encaps.c
@@ -24,6 +24,9 @@
#include "encaps.h"
+#include <assert.h>
+
+
#include "../routine.h"
#include "../type-int.h"
#include "../../common/extstr.h"
@@ -143,11 +146,13 @@ GDataType *g_encapsulated_type_new(EncapsulationType type, ...)
{
case ECT_ROUTINE:
result->routine = va_arg(ap, GBinRoutine *);
+ assert(result->routine != NULL);
g_binary_routine_set_name(result->routine, "(*)");
break;
default:
result->child = va_arg(ap, GDataType *);
+ assert(result->child != NULL);
break;
}