From f4a3112d5ee08344b1338875c7d0e20afc7d077c Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 23 Oct 2021 20:43:38 +0300 Subject: [PATCH] (input_is_empty): refactoring. Signed-off-by: Andrew Borodin --- lib/widget/input.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/widget/input.c b/lib/widget/input.c index ba1111b8c..528e89362 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -10,7 +10,7 @@ Jakub Jelinek, 1995 Andrej Borsenkow, 1996 Norbert Warmuth, 1997 - Andrew Borodin , 2009-2016 + Andrew Borodin , 2009-2022 This file is part of the Midnight Commander. @@ -1196,7 +1196,13 @@ input_assign_text (WInput * in, const char *text) gboolean input_is_empty (const WInput * in) { - return (in == NULL || in->buffer == NULL || in->buffer[0] == '\0'); + if (in == NULL) + return TRUE; + + /* if in != NULL, in->buffer must be created */ + g_assert (in->buffer != NULL); + + return in->buffer[0] == '\0'; } /* --------------------------------------------------------------------------------------------- */