Fixed issue with empty command delimiter

This meant that the delimiters were added when when both the icon and
output where empty.
This commit is contained in:
aidan 2020-08-29 11:58:28 -06:00
parent 3d308cafb0
commit 13c7700f34

View file

@ -56,6 +56,8 @@ void getcmd(const Block *block, char *output)
int i = strlen(block->icon); int i = strlen(block->icon);
fgets(output+i, CMDLENGTH-i-delimLen, cmdf); fgets(output+i, CMDLENGTH-i-delimLen, cmdf);
i = strlen(output); i = strlen(output);
if (i == 0)//return if block and command output are both empty
return;
if (delim[0] != '\0') { if (delim[0] != '\0') {
//only chop off newline if one is present at the end //only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i; i = output[i-1] == '\n' ? i-1 : i;