]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/news.cpp
Fixed a core bug hopefully
[irc/gameservirc.git] / gameserv / news.cpp
index 2040d2de1b64e918a082fa9dfe2749798a19363b..df06e70a59237e5320871e4f3735baff1c83c261 100644 (file)
@@ -76,11 +76,9 @@ void showNews(char *nick, List<myString> &news)
 
 void saveNews(char *filename, List<myString> &news)
 {
-    if (news.isEmpty())
-       return;
-
     ofstream outfile;
     outfile.open(filename);
+
     if (outfile.fail())
     {
        log("Error opening %s", filename);
@@ -125,6 +123,11 @@ void loadNews(char *filename, List<myString> &news)
 
     while (infile.getline(buf, 1024, '\n'))
     {
+       if (buf[0] == '\0' || buf[0] == '\n')
+       {
+           delete [] buf;
+           return;
+       }
        string = new myString(buf);
        news.insertAtBack(string);
        delete string;