Fix Bug in fd_get_file: In case fd not found, then returns NULL, w/ E

This commit is contained in:
sBubshait
2024-11-08 16:48:19 +00:00
parent 8912ef4660
commit e40794e672

View File

@@ -340,6 +340,9 @@ fd_get_file (int fd)
struct hash_elem *e struct hash_elem *e
= hash_find (&thread_current ()->open_files, &fake_file_info.elem); = hash_find (&thread_current ()->open_files, &fake_file_info.elem);
if (e == NULL)
return NULL;
return hash_entry (e, struct open_file, elem); return hash_entry (e, struct open_file, elem);
} }