diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 04b20b770aa98ff093cb4dd3dcf9953b725df372..ca98cc3f6fbd57e431bed1208bdb79d25598f8bc 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -1016,6 +1016,7 @@ ulong sbbs_t::msgeditor(char *buf, const char *top, char *title)
 		strcpy(buf,top);
 	else
 		buf[0]=0;
+	lines = strListCount(str);
 	for(i=0;i<lines;i++) {
 		strcat(buf,str[i]);
 		strcat(buf,crlf);