[PATCH] fwts_args: check for null text pointer

Colin King colin.king at canonical.com
Mon Jun 10 10:52:38 UTC 2019


From: Colin Ian King <colin.king at canonical.com>

The pointer text can potentially be null, so check for this.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_args.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
index 95a2a606..ccdcac51 100644
--- a/src/lib/src/fwts_args.c
+++ b/src/lib/src/fwts_args.c
@@ -274,6 +274,8 @@ static void fwts_args_show_option(
 
 	text = fwts_format_text(explanation,
 		width < 0 ? (FWTS_MIN_TTY_WIDTH - FWTS_ARGS_WIDTH-1) : width);
+	if (!text)
+		return;
 
 	fwts_list_foreach(item, text) {
 		printf("%-*.*s %s\n",
-- 
2.20.1




More information about the fwts-devel mailing list