From 5042737fef27c821535883dadfb0ad9ac81ad294 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Thu, 23 Apr 2015 23:12:48 +0000
Subject: Handled a strange case of jump outside the current routine.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@516 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                     |  5 +++++
 src/gtkext/graph/nodes/flow.c | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c1874c2..b9f23cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+15-04-24  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/gtkext/graph/nodes/flow.c:
+	Handle a strange case of jump outside the current routine.
+
 15-04-22  Cyrille Bagard <nocbos@gmail.com>
 
 	* src/dialogs/export.c:
diff --git a/src/gtkext/graph/nodes/flow.c b/src/gtkext/graph/nodes/flow.c
index 5ff21c9..558913e 100644
--- a/src/gtkext/graph/nodes/flow.c
+++ b/src/gtkext/graph/nodes/flow.c
@@ -327,6 +327,9 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes)
             {
                 target = G_FLOW_NODE(find_node_for_instruction(nodes, node->exits[0].instr));
 
+                /* Cf. commentaire de g_flow_node_link() */
+                if (target == NULL) break;
+
                 dest_slot = g_flow_node_get_slot(target, true,
                                                  last, node->exits[0].group_index);
 
@@ -335,6 +338,9 @@ static void g_flow_node_prepare_x_line(GFlowNode *node, GGraphNode *nodes)
             {
                 target = G_FLOW_NODE(find_node_for_instruction(nodes, node->exits[1].instr));
 
+                /* Cf. commentaire de g_flow_node_link() */
+                if (target == NULL) break;
+
                 dest_slot = g_flow_node_get_slot(target, true,
                                                  last, node->exits[1].group_index);
 
@@ -555,6 +561,13 @@ void g_flow_node_link(GFlowNode *node, GGraphLayout *layout, GGraphNode *nodes)
     {
         target = G_FLOW_NODE(find_node_for_instruction(nodes, node->exits[i].instr));
 
+        /**
+         * Il semblerait que l'adresse ciblée puisse ne correspondre à aucun bloc.
+         * Ce serait le cas pour un saut avec __gmon_start__ sous ARM, à confirmer (TODO).
+         * Référence. : http://stackoverflow.com/questions/12697081/what-is-gmon-start-symbol
+         */
+        if (target == NULL) continue;
+
         dest_slot = g_flow_node_get_slot(target, true,
                                          last, node->exits[i].group_index);
 
-- 
cgit v0.11.2-87-g4458