aboutsummaryrefslogtreecommitdiff
path: root/kernel/features/proc.c
diff options
context:
space:
mode:
authorMarvin Borner2020-10-26 16:36:40 +0100
committerMarvin Borner2020-10-26 16:36:40 +0100
commit197ea3ca20879b29fca41a07cf43e5b04b9c5083 (patch)
treec0e0223e289bde3af7cca995f98d681779bfda26 /kernel/features/proc.c
parent4ae48304b2290b6c835eb3d937bd5e905ce0e5d4 (diff)
Optimizations
Diffstat (limited to 'kernel/features/proc.c')
-rw-r--r--kernel/features/proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c
index b6ed442..5d1a437 100644
--- a/kernel/features/proc.c
+++ b/kernel/features/proc.c
@@ -34,13 +34,14 @@ void scheduler(struct regs *regs)
assert(proc_list->head);
- memcpy(&((struct proc *)current->data)->regs, regs, sizeof(struct regs));
+ if (current)
+ memcpy(&((struct proc *)current->data)->regs, regs, sizeof(struct regs));
if (priority_proc) {
current = list_first_data(proc_list, priority_proc);
priority_proc = NULL;
assert(current);
- } else if (current->next) {
+ } else if (current && current->next) {
current = current->next;
} else {
current = proc_list->head;
@@ -76,7 +77,7 @@ void proc_print()
struct node *node = proc_list->head;
printf("\nPROCESSES\n");
- struct proc *proc;
+ struct proc *proc = NULL;
while (node && (proc = node->data)) {
printf("Process %d: %s\n", proc->pid, proc->name);
node = node->next;