diff options
| author | nasrlol <nsrddyn@gmail.com> | 2025-02-18 21:12:56 +0100 |
|---|---|---|
| committer | nasrlol <nsrddyn@gmail.com> | 2025-02-18 21:12:56 +0100 |
| commit | 343880eb1afe7dea39a459e871eca70519d7b14b (patch) | |
| tree | ee8fb7af54229b19406fd73eb49ebc7e1fdc2065 | |
| parent | 6334869a10cf038f67fb1192b531cd4deaf4ea49 (diff) | |
handling seg faults again
Signed-off-by: nasrlol <nsrddyn@gmail.com>
| -rw-r--r-- | main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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); |
