do not segfault on empty input

This commit is contained in:
anon 2024-03-01 19:36:23 +01:00
parent 3bc43448fc
commit e332f72d22

@ -114,11 +114,15 @@ static void callback_handler(char *line) {
char ch; char ch;
shellpath(filename, sizeof(filename), line); shellpath(filename, sizeof(filename), line);
file = fopen(filename, "a+"); file = fopen(filename, "a+");
seekpage(0); if (file) {
while ((ch = getc(refsfound)) != EOF) { seekpage(0);
putc(ch, file); while ((ch = getc(refsfound)) != EOF) {
putc(ch, file);
}
fclose(file);
} else {
postmsg2("Failed to open file.");
} }
fclose(file);
input_mode = INPUT_NORMAL; input_mode = INPUT_NORMAL;
} return; } return;
case INPUT_READ: { case INPUT_READ: {