diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 4bd8732..96c099d 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -340,6 +340,9 @@ fd_get_file (int fd) struct hash_elem *e = hash_find (&thread_current ()->open_files, &fake_file_info.elem); + if (e == NULL) + return NULL; + return hash_entry (e, struct open_file, elem); }