From 29ca99a83826c0bd4f4dcdbefab9923c90a07bf9 Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 25 Apr 2024 18:56:41 +0200 Subject: [PATCH] Initialization --- cv10/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cv10/program.c b/cv10/program.c index 848f7ba..839b8dd 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -22,7 +22,7 @@ int main() { i = 0; while (i < count && fgets(buffer, sizeof(buffer), stdin)) { int len = strlen(buffer); - if (buffer[len - 1] == '\n') { // Remove newline character if present + if (len > 0 && buffer[len - 1] == '\n') { // Remove newline character if present buffer[len - 1] = '\0'; } int found = 0;