diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c
index 4c5ac282f5b0455c4952988af48543848cae63e6..fc9a971a35d7e09ea79e95cdfc48df8e57bb1d38 100644
--- a/src/sbbs3/websrvr.c
+++ b/src/sbbs3/websrvr.c
@@ -4646,7 +4646,8 @@ void http_logging_thread(void* arg)
 		char	sizestr[100];
 
 		if(!listSemTryWait(&log_list)) {
-			fflush(logfile);
+			if(logfile!=NULL)
+				fflush(logfile);
 			listSemWait(&log_list);
 		}