From 6c927b8a7c92b68b7f0668ec997b2d4c38fbc297 Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 7 Apr 2023 22:54:56 +0200 Subject: [PATCH] fix potential segmentation fault if clntext is NULL --- libs/arg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/arg.c b/libs/arg.c index 88fd2ff..fd289db 100644 --- a/libs/arg.c +++ b/libs/arg.c @@ -107,8 +107,7 @@ moveup(const Arg *arg) void complete(const Arg *arg) { - if (!sel) return; - + if (hideitem) return; strncpy(text, sel->clntext, sizeof text - 1); text[sizeof text - 1] = '\0'; cursor = strlen(text); @@ -284,7 +283,7 @@ selectitem(const Arg *arg) { char *selection; - if (sel && arg->i) { + if (sel && arg->i && !hideitem) { selection = sel->text; } else { selection = text;