From e12536752e95e58ab186ab61d82181a3cfa073fd Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Thu, 30 Mar 2017 23:05:22 +1000 Subject: [PATCH] fix silly mistake --- deps/aha/aha.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deps/aha/aha.c b/deps/aha/aha.c index 2f916a9..a129f17 100644 --- a/deps/aha/aha.c +++ b/deps/aha/aha.c @@ -135,6 +135,9 @@ char * aha(char *input) obl=bl; //Searching the end (a letter) and safe the insert: c= *ptr++; + if (c == '\0') { + return output; + } if ( c == '[' ) // CSI code, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors { char buffer[1024]; @@ -143,6 +146,9 @@ char * aha(char *input) while ((c<'A') || ((c>'Z') && (c<'a')) || (c>'z')) { c=*ptr++; + if (c == '\0') { + return output; + } buffer[counter]=c; if (c=='>') //end of htop break; @@ -363,5 +369,5 @@ char * aha(char *input) if ((fc!=-1) || (bc!=-1) || (ul!=0) || (bo!=0) || (bl!=0)) append_output(&output, "\n", &size, &outat); - return 0; + return output; }