From 562a56f01cfb81ff7538418dd183aaa53e90b17c Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 27 Aug 2017 20:15:41 +0200
Subject: Took into account that loading types from the Dex pool may fail.

---
 ChangeLog              | 5 +++++
 src/format/dex/class.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0605206..452f97c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 17-08-27  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/format/dex/class.c:
+	Take into account that loading types from the Dex pool may fail.
+
+17-08-27  Cyrille Bagard <nocbos@gmail.com>
+
 	* plugins/readdex/ids.c:
 	Take into account that some instruction creations may fail.
 
diff --git a/src/format/dex/class.c b/src/format/dex/class.c
index eb2ba3f..bb2ae71 100644
--- a/src/format/dex/class.c
+++ b/src/format/dex/class.c
@@ -24,7 +24,6 @@
 #include "class.h"
 
 
-#include <assert.h>
 #include <malloc.h>
 
 
@@ -233,7 +232,7 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
     if (def->access_flags & ACC_ANNOTATION) goto gdcn_done;
 
     ctype = get_type_from_dex_pool(format, def->class_idx);
-    assert(ctype != NULL);
+    if (ctype == NULL) goto gdcn_unknown_type;
 
     base = G_BIN_FORMAT(format);
 
@@ -299,6 +298,8 @@ GDexClass *g_dex_class_new(GDexFormat *format, const class_def_item *def)
 
     g_object_unref(G_OBJECT(ctype));
 
+ gdcn_unknown_type:
+
  gdcn_bad_item:
 
     g_object_unref(G_OBJECT(result));
-- 
cgit v0.11.2-87-g4458