diff --git a/views/thread.ejs b/views/thread.ejs
index 7f40045..e8ff01f 100644
--- a/views/thread.ejs
+++ b/views/thread.ejs
@@ -28,13 +28,13 @@
- <% if ((user.id === thread.authorID || user.admin ) && thread.state !== "DELETED"){ %>
+ <% if (user && (user.id === thread.authorID || user.admin ) && thread.state !== "DELETED"){ %>
DELETE
EDIT
<% } else if (thread.state == "DELETED") { %>
This thread has been deleted
- UNDELETE
- <% }; %>
+ UNDELETE
+ <% }; %>