ui_txt: fix a crash while searching - sacc - sacc(omys), simple console gopher client
HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR LICENSE
---
DIR commit edb683070a46f17242618569dacff02b6075115e
DIR parent c29025f3cc818b8e0f43d41d9a7d4b3220503cfa
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 6 Jul 2022 19:17:36 +0200
ui_txt: fix a crash while searching
Reproducable with an empty search string when using '/'.
Reported by pi31415 on IRC in #gopherproject, thanks!
Diffstat:
M ui_txt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
DIR diff --git a/ui_txt.c b/ui_txt.c
@@ -197,7 +197,7 @@ Item *
uiselectitem(Item *entry)
{
Dir *dir;
- char buf[BUFSIZ], *sstr, nl;
+ char buf[BUFSIZ], *sstr = NULL, nl;
int item, nitems;
if (!entry || !(dir = entry->dat))
@@ -281,7 +281,7 @@ uiselectitem(Item *entry)
yankitem(&dir->items[item-1]);
continue;
case '/':
- if (*sstr)
+ if (sstr && *sstr)
searchinline(sstr, entry);
continue;
case 'h':