From 39d326a77c26b7257122af3659204daefb87ad95 Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Thu, 28 Apr 2011 01:45:23 +0000 Subject: [PATCH] Don't dump core if Python was not able to load the dissector registration file (e.g., due to a syntax error). svn path=/trunk/; revision=36922 --- epan/wspython/wspy_register.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/epan/wspython/wspy_register.c b/epan/wspython/wspy_register.c index 91e71dfa73..b39cc4e548 100644 --- a/epan/wspython/wspy_register.c +++ b/epan/wspython/wspy_register.c @@ -143,7 +143,7 @@ void register_all_py_protocols_func(register_cb cb _U_, gpointer client_data _U_ /* load the python register module */ py_reg = fopen(get_py_register_file(), "r"); if (py_reg == NULL) { - printf("no register file %s\n", get_py_register_file()); + printf("Can't open Python registration file: %s\n", get_py_register_file()); return; } PyRun_SimpleFile(py_reg, get_py_register_file()); @@ -154,6 +154,10 @@ void register_all_py_protocols_func(register_cb cb _U_, gpointer client_data _U_ /* Get the python register function */ register_fn = PyDict_GetItemString(global_dict, "register_dissectors"); + if (register_fn == NULL) { + printf("Error in Python registration file: %s\n", get_py_register_file()); + return; + } /* Execute the python register function */ /* This function returns a sequence of python dissectors objects */