diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-04-28 01:45:23 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-04-28 01:45:23 +0000 |
commit | 39d326a77c26b7257122af3659204daefb87ad95 (patch) | |
tree | f8950b41342e72eda9004ae412bb96cc099e77a5 /epan/wspython | |
parent | 4e782042deac8368e1716296fccb3503eceae2b0 (diff) |
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
Diffstat (limited to 'epan/wspython')
-rw-r--r-- | epan/wspython/wspy_register.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 */ |