fix warnings by gcc 11; check if length <= zero

Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
6 jobs for code-cleanup in 2 minutes and 5 seconds (queued for 1 second)