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 --- capture_info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'capture_info.c') diff --git a/capture_info.c b/capture_info.c index 753bba0e80..3989d00faa 100644 --- a/capture_info.c +++ b/capture_info.c @@ -125,7 +125,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing, /* Seen only when opening a capture file for reading. */ g_snprintf(errmsg_errno, sizeof(errmsg_errno), "The file \"%%s\" contains record data that Wireshark doesn't support.\n" - "(%s)", err_info); + "(%s)", err_info != NULL ? err_info : "no information supplied"); g_free(err_info); errmsg = errmsg_errno; break; @@ -159,7 +159,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing, /* Seen only when opening a capture file for reading. */ g_snprintf(errmsg_errno, sizeof(errmsg_errno), "The file \"%%s\" appears to be damaged or corrupt.\n" - "(%s)", err_info); + "(%s)", err_info != NULL ? err_info : "no information supplied"); g_free(err_info); errmsg = errmsg_errno; break; @@ -183,7 +183,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing, case WTAP_ERR_DECOMPRESS: g_snprintf(errmsg_errno, sizeof(errmsg_errno), "The compressed file \"%%s\" appears to be damaged or corrupt.\n" - "(%s)", err_info); + "(%s)", err_info != NULL ? err_info : "no information supplied"); g_free(err_info); errmsg = errmsg_errno; break; -- cgit v1.2.3