gfio: prevent multitext crash on invalid update
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/gfio.c b/gfio.c
index 6a22777..7f47828 100644
--- a/gfio.c
+++ b/gfio.c
@@ -263,7 +263,7 @@
{
if (index >= mt->max_text)
return;
- if (!mt->text[index])
+ if (!mt->text || !mt->text[index])
return;
mt->cur_text = index;
@@ -273,6 +273,9 @@
static void multitext_update_entry(struct multitext_widget *mt,
unsigned int index, const char *text)
{
+ if (!mt->text)
+ return;
+
if (mt->text[index])
free(mt->text[index]);