From b5a9a3798f43136d5f72391c173880010baef901 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 28 Jan 2019 23:38:28 +0100
Subject: Taken into account buffer cache may be missing in batch mode.

---
 plugins/pychrysalide/analysis/binary.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/plugins/pychrysalide/analysis/binary.c b/plugins/pychrysalide/analysis/binary.c
index c173605..f73684b 100644
--- a/plugins/pychrysalide/analysis/binary.c
+++ b/plugins/pychrysalide/analysis/binary.c
@@ -218,9 +218,16 @@ static PyObject *py_loaded_binary_get_disassembled_cache(PyObject *self, void *c
     binary = G_LOADED_BINARY(pygobject_get(self));
     cache = g_loaded_binary_get_disassembled_cache(binary);
 
-    result = pygobject_new(G_OBJECT(cache));
-
-    g_object_unref(G_OBJECT(cache));
+    if (cache != NULL)
+    {
+        result = pygobject_new(G_OBJECT(cache));
+        g_object_unref(G_OBJECT(cache));
+    }
+    else
+    {
+        result = Py_None;
+        Py_INCREF(result);
+    }
 
     return result;
 
-- 
cgit v0.11.2-87-g4458