summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authornasrlol <nsrddyn@gmail.com>2025-02-18 21:12:56 +0100
committernasrlol <nsrddyn@gmail.com>2025-02-18 21:12:56 +0100
commit343880eb1afe7dea39a459e871eca70519d7b14b (patch)
treeee8fb7af54229b19406fd73eb49ebc7e1fdc2065 /main.c
parent6334869a10cf038f67fb1192b531cd4deaf4ea49 (diff)
handling seg faults again
Signed-off-by: nasrlol <nsrddyn@gmail.com>
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 4 insertions, 1 deletions
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);