From 0885d2945103236f7f475963f66048291f0b18f1 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 17 Dec 2014 20:03:47 -0800 Subject: Make sure err_info is always set, and print it iff it's non-null. Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b Reviewed-on: https://code.wireshark.org/review/5830 Reviewed-by: Guy Harris --- rawshark.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'rawshark.c') diff --git a/rawshark.c b/rawshark.c index 0fc46c05c4..f70c418526 100644 --- a/rawshark.c +++ b/rawshark.c @@ -1008,7 +1008,8 @@ load_cap_file(capture_file *cf) case WTAP_ERR_UNSUPPORTED: cmdarg_err("The file \"%s\" contains record data that Rawshark doesn't support.\n(%s)", - cf->filename, err_info); + cf->filename, + err_info != NULL ? err_info : "no information supplied"); g_free(err_info); break; @@ -1019,13 +1020,15 @@ load_cap_file(capture_file *cf) case WTAP_ERR_BAD_FILE: cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)", - cf->filename, err_info); + cf->filename, + err_info != NULL ? err_info : "no information supplied"); g_free(err_info); break; case WTAP_ERR_DECOMPRESS: cmdarg_err("The compressed file \"%s\" appears to be damaged or corrupt.\n(%s)", - cf->filename, err_info); + cf->filename, + err_info != NULL ? err_info : "no information supplied"); g_free(err_info); break; -- cgit v1.2.3