From 343880eb1afe7dea39a459e871eca70519d7b14b Mon Sep 17 00:00:00 2001 From: nasrlol Date: Tue, 18 Feb 2025 21:12:56 +0100 Subject: handling seg faults again Signed-off-by: nasrlol --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 6c81cfb..28f0677 100644 --- a/main.c +++ b/main.c @@ -91,7 +91,10 @@ int main(void) { const struct com_struct new_input = split_command(input); new_input.com[strcspn(new_input.com, "\n")] = '\0'; - new_input.arg[strcspn(new_input.arg, "\n")] = '\0'; + + if (new_input.arg != NULL) { + new_input.arg[strcspn(new_input.arg, "\n")] = '\0'; + } if (strcmp(new_input.com, "exit") == 0) { free(input); -- cgit v1.2.3-70-g09d2